The main benefit is for building lists (and dictionaries in Python 2.6+) 
because list.append() has to allocate more memory at each call.

Using the list comprehension allows it to allocate memory just once 
instead of N-times.

-tim

hcvst wrote:
> Thank you for your response, Tim. I didn't know that lists
> comprehension performs better.
> I assumed it to be mostly a short-hand notation inspired by a
> functional programming style.
>
> HC
> >
>   

-- 
Timothy Farrell <tfarr...@swgen.com>
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to