Forgetting "()" when calling methods

Andrew Henshaw andrew.henshaw at gtri.gatech.edu
Sun Apr 27 18:33:20 EDT 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:
    do_some_processing()


and do_some_processing is never called.

--Andy




More information about the Python-list mailing list