Alex Martelli wrote: > $ python -mtimeit -s'import itertools as it' -s'L=range(-7,17)' 'for x > in it.imap(abs,L): pass' > 100000 loops, best of 3: 3 usec per loop > $ python -mtimeit -s'import itertools as it' -s'L=range(-7,17)' 'for x > in (abs(y) for y in L): pass' > 100000 loops, best of 3: 4.47 usec per loop > > (imap is faster in this case because the built-in name 'abs' is looked > up only once -- in the genexp, it's looked up each time, sigh -- > possibly the biggest "we should REALLY tweak the language to let this > be optimized sensibly" gotcha in Python, IMHO). >
What is it about the language as it stands that requires abs() to be looked up each iteration? Neil _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com