[Python-Dev] the not operator (and the __not__ special method)

Aahz aahz@pythoncraft.com
Thu, 3 Oct 2002 19:22:15 -0400


On Thu, Oct 03, 2002, Brian Quinlan wrote:
>
> > shows that python doesn't call the __not__ special method
> > in a 'not' operator statement.
> 
> Python calls the special __nonzero__ method so check the truth value of
> an object.

Mark McEahern provided the full answer: Python uses __len__, too.
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/