[Python-Dev] Confusing listreverseiterator Behavior

Raymond Hettinger python at rcn.com
Tue Aug 26 22:05:46 CEST 2008


From: "Armin Ronacher" <armin.ronacher at active-4.com>
>>>> len(ri)
> 4
>>>> ri.next()
> 4
>>>> len(ri)
> 3
> 
> This is the only reverse iterator with that sort of behavior.  

Use the bug tracker please and assign to me.
At one time, some iterators had the ability to know
their own length and that would change as the
iterator got consumed.  Later, it was decided
that iterators should not report length and should
instead report a length hint.  It looks like listreversediterator
got missed when this was changed.


Raymond


More information about the Python-Dev mailing list