A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/006134.html below:

[Python-Dev] list comprehensions again...

[Python-Dev] list comprehensions again...Paul Prescod paul@prescod.net
Tue, 11 Jul 2000 17:11:29 -0500
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:

http://www.cosc.canterbury.ac.nz/~greg/python/listcomp/

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

Reduce is somewhat of a different beast...

-- 
 Paul Prescod - Not encumbered by corporate consensus
Simplicity does not precede complexity, but follows it. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4