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

Moshe Zadka Moshe Zadka <moshez@math.huji.ac.il>
Thu, 13 Jul 2000 07:44:40 +0300 (IDT)


On Wed, 12 Jul 2000, Paul Prescod wrote:

> Moshe Zadka wrote:
> > 
> > What would people think about xmap(), which acts anologously to xrange(),
> > IOW calculate lazilly instead of eagerly? Or even, calculate "on demand",
> > without caching:
> > ....
> > Wouldn't this solve the parallel iteration problem?
> 
> I don't think that using a function called "xmap" to build tuples is
> very intuitive to start with. What's so wrong with a builtin called
> "tuples()"?

The name isn't so important -- what is more important is the lazy aspect
of the thing. (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.

--
Moshe Zadka <moshez@math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez