When you get an error message that indicates Python can't count arguments, it's generally because the number of arguments you've passed is equal to the number of required arguments, but you're missing some required arguments and including some optional arguments. In this case, you have the following definition:
def integrate(f, z, gamma, t, lower, upper, exact=True):
and the following call:
integrate(f, z, gamma, 0, 2*sy.pi, exact=True)
If we line them up, we see
def integrate(f, z, gamma, t, lower, upper, exact=True):
integrate(f, z, gamma, 0, 2*sy.pi, exact=True)
that you're missing one of lower
, upper
, or t
, but because you've supplied exact
, the error reporting gets confused.
Python 3 has a better error message for things like this:
>>> def f(a, b=0): pass
...
>>> f(b=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() missing 1 required positional argument: 'a'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…