Forgetting "()" when calling methods

Peter Hansen peter at engcorp.com
Sat Apr 26 01:02:03 CEST 2003


Frantisek Fuka wrote:
> 
> When I try to call methods, I sometimes forget to include the
> parentheses. Instead of:
> 
> if object.isGreen():
>         do something...
> 
> i sometimes write:
> 
> if object.isGreen:
>         do something...

All I can offer is that if you are doing test-driven development,
or writing unit tests for your code, you will very quickly 
catch this kind of problem and it will largely cease to be a
big issue for you.  Not only that, but you'll probably find 
yourself cured of the root problem fairly soon.

Python is an *excellent* language for agile methods, including
test-driven development.  Check the archives for various threads
on the topic of unit-testing with Python.

-Peter




More information about the Python-list mailing list