while 1 vs while True

Timothy Fitz firemoth at gmail.com
Mon Dec 13 02:54:22 CET 2004


[ http://www.python.org/moin/PythonSpeed ]
"Starting with Py2.3, the interpreter optimizes 'while 1' to just a
single jump. In contrast "while True" takes several more steps. While
the latter is preferred for clarity, time-critical code should use the
first form."

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



More information about the Python-list mailing list