[Python-Dev] list comprehensions again...
Wed, 12 Jul 2000 14:07:37 +0200
On Tue, Jul 11, 2000 at 05:11:29PM -0500, Paul Prescod wrote:
> Thomas Wouters wrote:
> > .... They provide an easier way to create a list, but they don't
> > eradicate the need for map, reduce or filter, because there is no way to
> > comprehend an already created list.
> What do you mean? I think I see examples of list comprehensions working
> on existing lists on this page:
> numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
> evens = [x for x in numbers if x % 2 == 0] # filter
> mult3 = [3 * x for x in numbers] # map
Yes, sorry, I don't know what posessed me to say that, I was obviously
mistaken. What can I say, it was late, I was exhausted ;)
Thomas Wouters <email@example.com>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!