while 1 vs while True

Raymond Hettinger vze4rx4y at verizon.net
Tue Dec 14 05:15:04 EST 2004


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


Raymond Hettinger





More information about the Python-list mailing list