A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008305.html below:

list comprehensions (was parsers and compilers for 2.0)

[Python-Dev] RE: list comprehensions (was parsers and compilers for 2.0)esr@thyrsus.com esr@thyrsus.com
Mon, 14 Aug 2000 18:57:18 -0400
Greg Ewing <greg@cosc.canterbury.ac.nz>:
> Two reasons why list comprehensions fit better in Python
> than the equivalent map/filter/lambda constructs:
> 
> 1) Scoping. The expressions in the LC have direct access to the
>    enclosing scope, which is not true of lambdas in Python.

This is a bug in lambdas, not a feature of syntax.
 
> 2) Efficiency. An LC with if-clauses which weed out many potential
>    list elements can be much more efficient than the equivalent
>    filter operation, which must build the whole list first and
>    then remove unwanted items.

A better argument.  To refute it, I'd need to open a big can of worms
labeled "lazy evaluation".
-- 
		<a href="http://www.tuxedo.org/~esr">Eric S. Raymond</a>

Freedom, morality, and the human dignity of the individual consists
precisely in this; that he does good not because he is forced to do
so, but because he freely conceives it, wants it, and loves it.
	-- Mikhail Bakunin 



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