Batista, Facundo wrote: > I think that breaking the common idiom... > > for e in something[:]: > something.remove(e) > > is a no-no... The patch doesn't change existing behaviour - anything which is already sliceable (e.g. lists) goes through the existing __getitem__ or __getslice__ code paths. All the patch adds is two additional checks (the first for an iterator, the second for an iterable) before PyObject_GetItem fails with the traditional "TypeError: unsubscriptable object". Defining __getitem__ also allows any given iterator or iterable type to override the default slicing behaviour if they so choose. Regards, Nick. -- Nick Coghlan | ncoghlan at email.com | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net
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