[EMAIL PROTECTED] writes: > I tested this using the timeit module, and though the difference was > small, I would have expected the first code block to do slightly > worse,
Can you post your entire benchmark, so that we can repeat it? When I tried the obvious, I got the expected result: $ python -m timeit -s 'l=[]' 'len(l)==1000' 1000000 loops, best of 3: 0.256 usec per loop $ python -m timeit -s 'l=[]' 'len(l)==1000' 1000000 loops, best of 3: 0.27 usec per loop $ python -m timeit -s 'l=[]' 's=len(l); s==1000' 1000000 loops, best of 3: 0.287 usec per loop $ python -m timeit -s 'l=[]' 's=len(l); s==1000' 1000000 loops, best of 3: 0.299 usec per loop -- http://mail.python.org/mailman/listinfo/python-list