[Python-Dev] Single- vs. Multi-pass iterability

Neal Norwitz neal@metaslash.com
Fri, 19 Jul 2002 18:47:38 -0400


Aahz wrote:
> 
> On Fri, Jul 19, 2002, Guido van Rossum wrote:
> >Ping:
> >>
> >> I think the renaming of next() to __next__() is a good idea in any
> >> case.  It is distant enough from the other issues that it can be done
> >> independently of any decisions about __iter__.
> >
> > Yeah, it's just a pain that it's been deployed in Python 2.2 since
> > last December, and by the time 2.3 is out it will probably have been
> > at least a full year.  Worse, 2.2 is voted to be Python-in-a-Tie,
> > giving that particular idiom a very long lifetime.  I simply don't
> > think we can break compatibility that easily.  Remember the endless
> > threads we've had about the pace of change and stability.  We have to
> > live with warts, alas.  And this is a pretty minor one if you ask me.
> 
> Is this a Pronouncement, or are we still waiting on the results of the
> survey?  Note that several people have suggested a multi-release
> strategy for fixing this problem; does that make any difference?

Would it be good to use __next__() if it exists, else try next()?
This doesn't fix the current 'wart,' however, it could allow
moving closer to the desired end.  It could cause confusion.
For compatability, one would only need to do:

	next = __next__

or vica versa.

Not sure this is worth it.  But if there is a transition, it could
ease the pain.

Neal