On 5 January 2016 at 12:46, Andrew Barnert via Python-ideas
On Jan 4, 2016, at 12:31, Guido van Rossum
wrote: On Fri, Jan 1, 2016 at 2:25 PM, Andrew Barnert
wrote: On Dec 27, 2015, at 09:04, Guido van Rossum
wrote: If we really want a way to turn something that just supports __getitem__ into an Iterable maybe we can provide an additional ABC for that purpose; let's call it a HalfSequence until we've come up with a better name. (We can't use Iterable for this because Iterable should not reference __getitem__.)
#25988 (using Nick's name Indexable, and the details from that post).
Oh, interesting. Though I have misgivings about that name.
Now that you mention it, I can see the confusion. I interpreted Nick's "Indexable" to mean "subscriptable by indexes (and slices of indexes)" as opposed to "subscriptable by arbitrary keys". But if I didn't already know what he intended, I suppose I could have instead guessed "usable as an index", which would be very misleading.
There don't seem to be any existing terms for this that don't relate to "sequence", so maybe your HalfSequence (or Sequential or SequentiallySubscriptable or something even more horrible than that last one?) is the best option?
Or, hopefully, someone _can_ come up with a better name. :)
I mainly suggested Indexable because it was the least-worst name I could think of, and I'd previously suggested Index as the name for "has an __index__ method" (in the context of typing, but it would also work in the context of collections.abc). The main alternative I've thought of is "IterableByIndex", which is both explicit and accurate, with the only strike against it being length. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia