I found the "while True" vs "while 1" both interesting and improbable, so I ran a quick test (code is here: https://gist.github.com/1828270). Turns out that the author is right -- while True is always slower -- but in Python 3, the difference is minor enough to be negligible, and in PyPy it's all so fast it doesn't matter. Results:
while True while 1
pypy 1.7.0: 0.0733 0.0201
cpython 2.7.1 0.146 0.109
cpython 3.2.2 2.79 2.72
Edit: I see now that pingveno posted an explanation of why this is true (heh) in his comment below
1
u/haldean (lambda x: x.decode('base64'))('PDMgcHlweQ==\n') Feb 14 '12
I found the "while True" vs "while 1" both interesting and improbable, so I ran a quick test (code is here: https://gist.github.com/1828270). Turns out that the author is right -- while True is always slower -- but in Python 3, the difference is minor enough to be negligible, and in PyPy it's all so fast it doesn't matter. Results:
Edit: I see now that pingveno posted an explanation of why this is true (heh) in his comment below