[Python-Dev] re: list comprehension / pop quiz

Paul Prescod paul@prescod.net
Wed, 12 Jul 2000 23:31:06 -0500


Moshe Zadka wrote:
> 
> ...
> 
> The name isn't so important -- what is more important is the lazy aspect
> of the thing. 

Names are always important. Is an xmap like an x-man?

> (And anyway, map/xmap is more general then tuples:
> 
> def tuples(*lists):
>         apply(map, (None,)+lists)
> ) and I see no reason not to support the stronger construct -- tuples
> could be build above it.

I agree. I just think that the stronger construct should be called "lazy
list comprehension". list comps. are much more general than maps and
also easier to read. As you've pointed out, making them lazy also makes
them more powerful. I don't think that there is any need for the eager
equivalent because it is so easy to resolve a lazy one to an eager one
in the rare case that that's what you need.

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