> > * There is a small group (including Jeremy Fincher) that consider a > > reversal protocol to be essential. > > And I think that as a protocol it needs a separate PEP, because new > protocols are much more involved than new builtins. Great idea. The champions for __reverse__ can plead their case there. > > * It is particularly useful for xrange() because it reduces the overhead > > to zero without touching the API. The implementation patch on SF shows > > that this can be done cleanly. Essentially, __reverse__ forwards the > > call to __iter__ with the arguments rearranged for reverse order. > > The implementation could special-case xrange() and lists and "optimize > the snot out of them" without the need for a general protocol. Agreed! I'll take __reversed__ out of the pep. May I mark this one as accepted and move on? 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