Calling Function Without Parentheses!
danb_83 at yahoo.com
Mon Jan 3 03:10:15 CET 2005
> What a debug nightmare! I just spent HOURS running my script through
> the debugger, sprinkling in log statements, and the like, tracking
> my problem.
> I called a function without the ending parentheses. I sure do WISH
> Python would trap it when I try to do the following:
> instead of:
You're a former Pascal programmer, aren't you? ;-)
In Python, it's not an error, because you can do things like:
>>> def simpson(f, a, b):
... "Simpson's Rule approximation of the integral of f on [a, b]."
... return (b - a) * (f(a) + 4 * f((a + b) / 2.0) + f(b)) / 6.0
>>> simpson(math.sin, 0.0, math.pi) # Note that math.sin is a function
More information about the Python-list