[Python-Dev] Re: PEP 322: Reverse Iteration
Andrew P. Lentvorski, Jr.
bsder at allcaps.org
Wed Nov 5 19:26:12 EST 2003
On Wed, 5 Nov 2003, Guido van Rossum wrote:
> I'm okay with adding reversed() as a builtin that works for sequences
> only but I'm not okay with adding the __reversed__ protocol.
But, doesn't this effectively take the PEP back to the original proposal
of a sequence method that it drifted away from?
With the restriction to sequences, reversed() is then likely to be
implemented as a thin wrapper around seq.somerevmethod() which could then
return either a new reversed sequence, an iterable, or an iterator
depending upon efficiency, implementation, thread-safety, etc.
Since reversed() is turning out not be generally applicable anyway,
perhaps going back to the original idea of a sequence method would be a
good thing?
-a
More information about the Python-Dev
mailing list