Raymond Hettinger wrote:
Dan Bishop wrote:

Out of pure curiousity,
Why wasn't 'While True' optimized also?


Probably has something to do with "True" and "False" not being
constants.


[Nick Coghlan]

Yup. Even 'None' only just became a constant in 2.4.

I don't know if 'True' and 'False' are in line for similar treatment (there

are

obvious backwards compatibility issues in doing so).


It is unlike to before Py3.0.  Making them constants would break the reams of
compatability code:  True, False = (1==1), (1!=1).

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)

regards
 Steve
--
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to