[Python-Dev] An issue recently brought up in patch #872326 (generator expression) (original) (raw)

Guido van Rossum guido at python.org
Mon Mar 22 19:33:36 EST 2004


> IIRC, most people agreed on that iterables in the generator expression need > to be pre-computed (including myself). But there's a recent issue about > that.

If we're capturing the value of free variables, is there any need to pre-compute the iterators?

A free variable might be a function that itself references globals (or at least nonlocals) that might change.

There is also the issue of exceptions: I'd expect exceptions in the toplevel (first) iterable to be raised immediately, and not when the first element of the iterator is requested.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list