[Python-ideas] Introduce collections.Reiterable
Stephen J. Turnbull
stephen at xemacs.org
Sun Sep 22 18:30:40 CEST 2013
Nick Coghlan writes:
> And these are exactly the cases that I am saying *deliberately*
> fail the more formal check instituted in PEP 3119. The __getitem__
> fallback is a backwards compatibility hack, not part of the formal
> definition of an iterable.
I think that resolves my issue that __getitem__ is polymorphic, too.
That is, item access by integer index doesn't care about order (could
be a table of Goedel numbers) any more item access by arbitrary
hashable does, and __iter__ takes care of the cases where the
programmer does care about order.
More information about the Python-ideas