Forgetting "()" when calling methods

Andrew Bennetts andrew-pythonlist at puzzling.org
Sun Apr 27 01:56:43 EDT 2003


On Sat, Apr 26, 2003 at 10:15:03PM -0700, Jeremy Fincher wrote:
> Frantisek Fuka <fuka at fuxoft.cz> wrote in message news:<b8cadp$1fj9$1 at ns.felk.cvut.cz>...
> > 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...
> 
> Perhaps the answer is to remove the __nonzero__ method on
> functions/methods.  Logically, what purpose does it serve?

For that matter, removing __nonzero__ from functions still doesn't help this
case:

    sys.exit

So it's of pretty minimal benefit.

-Andrew.






More information about the Python-list mailing list