Calling Function Without Parentheses!
Max M
maxm at mxm.dk
Sun Jan 2 22:03:16 EST 2005
Kamilche wrote:
> What a debug nightmare! I just spent HOURS running my script through
> the debugger, sprinkling in log statements, and the like, tracking down
> 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:
> MyFunc
Actually you want use a method as an ordinary variable without calling
it in many cases. It is often used in a dynamic language.
A simple example is:
result = []
a = result.append
if something:
a('some result')
elif something_else:
a('another result')
else:
a('default result')
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
More information about the Python-list
mailing list