[Python-Dev] pep 279 rehashed

Ian Kjos ikjos@email.uophx.edu
Wed, 24 Apr 2002 15:40:51 -0500


/me attempts to avoid HTML-mail.

+1 for numer() in the short run, but I don't know if I get a vote yet.

I don't know if it's too late yet, but what PEP 279 really seems to want is
iterator comprehensions. I have wanted those myself for a bit of a while. If
nobody minds, how about these classes:

Counter -> iterator over unbounded arithmetic sequence, with specified start
and optional arbitrary step.

IterComp -> convert a transform function, a list of iterators and an
optional selection function into a new lazy iterator, using
comprehension-type semantics. Expect frequent use of lambdas.

Wait! Isn't this just like programming with streams? Is there room in the
python model for an explicit stream type? (Yes, it's called a generator.
Perhaps we should just use those wisely.)