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 | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com