do...while loops

Daniel Klein danielk at aracnet.com
Tue Feb 6 09:52:39 EST 2001


On Tue, 6 Feb 2001 15:00:33 +0200, Langa Kentane <LangaK at discoveryhealth.co.za>
wrote:

>Why is is it while 1:
>would while 2:
>or 	while 3: work?

Of course it will work. The only integer that doesn't test for 'true' is 0 (or
-0).

Coming from a Smalltalk background I don't like using integer literals for
this. Instead I define a module like

	system_constants.py
	true = 1
	false = 0
etc...

and then write the loop as:

	while true:

Daniel Klein
Portland OR USA




More information about the Python-list mailing list