[Tutor] list comprehension efficiency

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Feb 19 02:45:38 CET 2012


On 19/02/2012 01:31, Bill Allen wrote:
> Generally speaking, are list comprehensions more efficient that the
> equivalent for loop with interior conditionals for a given task?  Do they
> compile down to the same Python byte code?
>
> Thanks,
> Bill Allen
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

Use the timeit module to answer Q1 and the dis module to answer Q2.

-- 
Cheers.

Mark Lawrence.



More information about the Tutor mailing list