> > I believe the assumption is that enumerate (as well as the proposed > irange) > > would grow an __reversed__ method to handle just that usage. Unfortunately, that idea didn't work out. The enumerate object does not hold the original iterable; instead, it only has the result of iter(iterable). Without having the iterable, I don't see a way for it to call iterable.__reversed__. The essential problem that at creation time, the enumerate object does know that it is going to be called by reversed(). No other sequence object has to have a __reversed__ method. Like its cousin, __iter__, some objects may be a performance boost from a custom iterator but none of them have to have it. Raymond Hettinger
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4