while true: !!!

David Porter jcm at bigskytel.com
Tue Dec 19 14:15:46 CET 2000


* Alex Martelli <aleaxit at yahoo.com>:
> "Rainer Deyke" <root at rainerdeyke.com> wrote in message
> news:KTz%5.48644$x6.22165257 at news2.rdc2.tx.home.com...
> >
> > 0 is false, None is false, [] is false, () is false, {} is false, and x is
> > false where x is a class instance and x.__nonzero__() returns false.
> > Everything else is true.  I think.
> 
> Another couple of 'false's: a class instance which doesn't define
> __nonzero__ but does define __length__ when the latter returns 0;
> and, C-implemented user objects, similarly to class instances.
> 
> I don't _think_ there are any more...

An empty string is also false.


 David
 




More information about the Python-list mailing list