PEP 276 (was Re: Status of PEP's?)

Raymond Hettinger python at rcn.com
Sat Mar 2 03:06:06 EST 2002


"David Eppstein" <eppstein at ics.uci.edu> wrote in message
news:eppstein-EBDEA3.22522001032002 at news.service.uci.edu...
> In article <a5psh2$ga8$1 at bob.news.rcn.net>,
>  "Raymond Hettinger" <python at rcn.com> wrote:
>
> > There is a pair of ideas that are intuitive, clean, and routinely
useful:
> >    for i in indici(seqn)
> >    for i, item in indexed(seqn)
>
> Isn't this in PEP 212?
> Maybe it should be undeferred?
> --
> David Eppstein       UC Irvine Dept. of Information & Computer Science
> eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/

PEP 212 pre-dates generators and iterators.  Back then, a list method
seemed more attractive because there weren't that many things that
could be iterated over.  Hence, the argument for a built-in function
was weaker.  Since there were no generators, the idea of a lazily
produced sequence wasn't in mind.  Hence, the memory and time
cost of building a separate items type list made the whole idea
seem less  attractive.  Further, generatorless version of the idea
was weak because its equivalent could be directly and simply
coded:  for i, item in zip(xrange(sys.maxint),seqn).

So maybe this is PEP 212 re-incarnated in generator form and
perhaps now the arguments for are much more compelling and
the arguments against no longer matter.

It doesn't matter to me whether we call it PEP 212, PEP 276, or
PEP 279.  Let's all just vote +1 and beg Guido to put it in ver 2.3.


Raymond Hettinger


P.S.  If 212 can get revised in generator form, then YES, let's
undefer it.





More information about the Python-list mailing list