True, False, None (was re. Pruss's manifesto)
Ron Adam
radam2 at tampabay.rr.com
Mon Nov 10 16:39:55 EST 2003
On Mon, 10 Nov 2003 13:41:59 GMT, Alex Martelli <aleax at aleax.it>
wrote:
>
>[alex at lancelot test]$ timeit.py -c -s'import itertools as it' 'c=it.count()'
>'while True:' ' if c.next()>99: break'
>10000 loops, best of 3: 91 usec per loop
>
>[alex at lancelot test]$ timeit.py -c -s'import itertools as it' 'c=it.count()'
>'while 1:' ' if c.next()>99: break'
>10000 loops, best of 3: 76 usec per loop
>
>...it still seems silly to slow things down by 20% w/o good reason...
>
Is it possible to make the argument optional for while? That may
allow for an even faster time?
while:
<instructions>
It would be the equivalent as making the default argument for while
equal to 1 or True. Could it optimize to single cpu instruction when
that format is used? No checks or look ups at all?
_Ron Adam
More information about the Python-list
mailing list