Python 2.0b1 List comprehensions are slow

phil hunt philh at comuno.freeserve.co.uk
Fri Sep 8 10:02:08 EDT 2000


On Fri, 8 Sep 2000 10:05:13 +0100, Robin Becker <robin at jessikat.fsnet.co.uk> wrote:
>In article <8p9ho7$4g0$1 at prometheus.acsu.buffalo.edu>, Kevin O'Connor
><koconnor at cse.buffalo.edu> writes
>...
>I get much the same results, but using dis the reason is obvious
>ie the comprehensions are revealed as macros rather than a fast
>operation
>
>bar2/3
>def bar2(arry):
>        return map(lambda x: x+12, arry)
>def bar3(arry):
>        return [ x+12 for x in arry]
>
>[...]

Couldn't this be fixed by having the compiler compiling the comprehensions
as if they were map() calls?


-- 
*****[ Phil Hunt ]*****
"Something has gone wrong with your computer. Don't worry your silly little
head about what has gone wrong; here's a pretty animation of a paperclip to
look at instead."
         -- Windows2007 error message, extrapolated

               




More information about the Python-list mailing list