Forgetting "()" when calling methods

Aahz aahz at pythoncraft.com
Sun Apr 27 02:22:44 EDT 2003


In article <698f09f8.0304262115.386c2571 at posting.google.com>,
Jeremy Fincher <tweedgeezer at hotmail.com> wrote:
>
>Perhaps the answer is to remove the __nonzero__ method on
>functions/methods.  Logically, what purpose does it serve?

"I see no __nonzero__ method here."

Anyone wanna guess what quote I'm mangling?  ;-)

Anyway, all objects that do not implement a __nonzero__ method are true:

>>> class C: pass
...
>>> x = C()
>>> print not(not x)
1
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles:  boring syntax, unsurprising semantics,
few automatic coercions, etc etc.  But that's one of the things I like
about it."  --Tim Peters on Python, 16 Sep 93




More information about the Python-list mailing list