while 1 vs while True

Fredrik Lundh fredrik at pythonware.com
Tue Dec 14 14:34:42 CET 2004


Steve Holden wrote:

> It was unfortunate that so many people chose to use that for compatibility, when if they'd used 
> the same code that the win32all extensions did they could have retained backward compatibility 
> even across a change to constants:
>
> try:
>     True
> except AttributeError:
>     True, False = (1==1), (1!=1)

that doesn't work, though:

$ python2.1 test.py
Traceback (most recent call last):
  File "test.py", line 2, in ?
    True
NameError: name 'True' is not defined

</F> 






More information about the Python-list mailing list