Steve Holden wrote:
> Fredrik Lundh wrote:
> > Steve Holden wrote:
> >
...
> """if performance is *really* important, you
> need to benchmark both options"""
Fair point.
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Steve Holden wrote:
>
>
>>And statements like that are probably going to annoy me ;-)
>>
>> >>> t = timeit.Timer("b = map(lambda x: x-1, a)", setup="a=[1,2,3]")
>> >>> t.timeit()
>>2.4686168214116599
>> >>> t = timeit.Timer("b = [x-1 for x in a]", setup="a=[1,2,3]")
>> >>>
Steve Holden wrote:
> And statements like that are probably going to annoy me ;-)
>
> >>> t = timeit.Timer("b = map(lambda x: x-1, a)", setup="a=[1,2,3]")
> >>> t.timeit()
> 2.4686168214116599
> >>> t = timeit.Timer("b = [x-1 for x in a]", setup="a=[1,2,3]")
> >>> t.timeit()
> 0.99302453244756