possibly trivial newbie list/array question

Paul Rubin phr-n2001 at nightsong.com
Thu Aug 23 07:39:07 EDT 2001


Can you tell me the actual purpose of list comprehension?  

        [f(x) for x in a]

just seems like confusing syntactic hair that's otherwise equivalent
to, though as we've seen sometimes slower than,

        map(lambda x: f(x), a).

Am I missing something?  Unless there's more to it than I see (which
is quite possible), I don't understand why this feature made it into
the language.




More information about the Python-list mailing list