Forgetting "()" when calling methods

Andrew Henshaw andrew.henshaw at
Mon Apr 28 00:33:20 CEST 2003

<posted & mailed>

Alex Martelli wrote:

> Klaus Meyer wrote:
>>> I don't know what to DO about it, but some minor tweaks might help.
>> I also have made this mistake sometimes.
>> On reason, i think, is the mix of function-call and values, example:
>> import time
>> print time.time()
>> print time.timezone
>> You have to remember the doc of the module carefully to make no mistake.
> Well, in this case it's no big deal, actually --
>>>> print time.time
> <built-in function time>
> i.e. if you forget parentheses you get an immediate reminder of that.
This reminds me of a recent bug that bit me for a few minutes:

import time

endTime = time.time() + RUN_TIME
while time.time < endTime:

and do_some_processing is never called.


More information about the Python-list mailing list