pointless musings on performance
Rob Williscroft
rtw at freenet.co.uk
Tue Nov 24 07:31:37 EST 2009
mk wrote in news:mailman.915.1259064240.2873.python-list at python.org in
comp.lang.python:
>
> def pythonic():
> def unpythonic():
> Decidedly counterintuitive: are there special optimizations for "if
> nonevar:" type of statements in cpython implementation?
>
from dis import dis
dis( unpythonic )
18 31 LOAD_FAST 0 (nonevar)
34 LOAD_CONST 0 (None)
37 COMPARE_OP 9 (is not)
40 JUMP_IF_FALSE 4 (to 47)
dis( pythonic )
11 31 LOAD_FAST 0 (nonevar)
34 JUMP_IF_FALSE 4 (to 41)
Rob.
More information about the Python-list
mailing list