while true: !!!

Rainer Deyke root at rainerdeyke.com
Tue Dec 19 03:39:38 CET 2000

"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
> >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.

Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

More information about the Python-list mailing list