Python provides a way to get both the value of the function and its
derivative in a single function call. We simply compute and return
both values as follows:


f
and dfdx
is done
term by term, in the order written, just as we want.
A bunch of commaseparated values is called a ``tuple'' in Python lingo. They can be written inside parentheses. Tuples can have any number of values, including none.
Note that the quadratic.py
example also used a tuple:

eval
function returns a tuple of three values.