[Python-ideas] Deprecating the old-style sequence protocol
Alexander Walters
tritium-list at sdamon.com
Tue Jan 5 09:13:24 EST 2016
Devils Advocate: Please don't make me press shift more than twice in a
base class name if you expect me to use it. It just makes annoying
avoidable typos more common.
'Subscripted' sounds good to me, if that's worth anything.
On 1/5/2016 00:50, Nick Coghlan wrote:
> On 5 January 2016 at 12:46, Andrew Barnert via Python-ideas
> <python-ideas at python.org> wrote:
>> On Jan 4, 2016, at 12:31, Guido van Rossum <guido at python.org> wrote:
>>
>> On Fri, Jan 1, 2016 at 2:25 PM, Andrew Barnert <abarnert at yahoo.com> wrote:
>>> On Dec 27, 2015, at 09:04, Guido van Rossum <guido at python.org> 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.
>
More information about the Python-ideas
mailing list