while true: !!!

Steve Holden sholden at holdenweb.com
Tue Dec 19 14:29:46 CET 2000


Alex Martelli <aleaxit at yahoo.com> wrote in message
news:91nc7h0s0p at news2.newsguy.com...
> "Rainer Deyke" <root at rainerdeyke.com> wrote in message
> news:KTz%5.48644$x6.22165257 at news2.rdc2.tx.home.com...
> > "Steve Lamb" <grey at despair.rpglink.com> wrote in message
> > news:slrn93t7bv.le.grey at teleute.rpglink.com...
> > > On Mon, 18 Dec 2000 23:32:23 +0100 (MET), Carsten Geckeler
> > <nospam at no.spam>
> > > wrote:
> > > >`while true' would be more readable and clear than `while 1'.  By the
> > way,
> > > >explain a newbie that -1 is true. ;)
> > >
> > >     0 is true, all else is false.  And?  :P
> >
> > 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...
>
>
> Alex
>
Nothing is true.  All is permitted.  Hassan-i-Sabbah

regards
 Steve








More information about the Python-list mailing list