Re: [Python-ideas] Deprecating the old-style sequence protocol

[Adding python-ideas back -- I'm not sure why you dropped it but it looks like an oversight, not intentional] On Fri, Jan 1, 2016 at 2:25 PM, Andrew Barnert <abarnert@yahoo.com> wrote:
That sounds about right.
Yes, that's fine. Deprecation sometimes just has to take a really long time.
Oh, interesting. Though I have misgivings about that name.
Thanks! -- --Guido van Rossum (python.org/~guido)

On Jan 4, 2016, at 12:31, Guido van Rossum <guido@python.org> wrote:
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. :)

On 5 January 2016 at 12:46, Andrew Barnert via Python-ideas <python-ideas@python.org> wrote:
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

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:

Or maybe Indexable is fine after all, since the arguments to __getitem__ are supposed to be objects with an __index__ method (e.g. Integral, but not Real). BTW, Maybe Index needs to be added to numbers.py as an ABC? PEP 357, which introduced it, sounds like it pre-dates ABCs. On Tue, Jan 5, 2016 at 6:13 AM, Alexander Walters <tritium-list@sdamon.com> wrote:
-- --Guido van Rossum (python.org/~guido)

On Jan 5, 2016, at 09:17, Alexander Walters <tritium-list@sdamon.com> wrote:
Basically, in the context of what makes a sequence different from a mapping. The idea here is to have a way to signal that a class follows the old-style sequence protocol, as opposed to being a mapping or some other use of __getitem__: you can access its elements by subscripting it with indexes from 0 up to the first one that raises IndexError (or up to __len__, if you provide it, but that isn't necessary). But this doesn't have to be airtight for type proofs or anything; if your class inherits from Indexable but then accepts integers too large to fit in an Index, that's fine.

On Jan 4, 2016, at 12:31, Guido van Rossum <guido@python.org> wrote:
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. :)

On 5 January 2016 at 12:46, Andrew Barnert via Python-ideas <python-ideas@python.org> wrote:
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

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:

Or maybe Indexable is fine after all, since the arguments to __getitem__ are supposed to be objects with an __index__ method (e.g. Integral, but not Real). BTW, Maybe Index needs to be added to numbers.py as an ABC? PEP 357, which introduced it, sounds like it pre-dates ABCs. On Tue, Jan 5, 2016 at 6:13 AM, Alexander Walters <tritium-list@sdamon.com> wrote:
-- --Guido van Rossum (python.org/~guido)

On Jan 5, 2016, at 09:17, Alexander Walters <tritium-list@sdamon.com> wrote:
Basically, in the context of what makes a sequence different from a mapping. The idea here is to have a way to signal that a class follows the old-style sequence protocol, as opposed to being a mapping or some other use of __getitem__: you can access its elements by subscripting it with indexes from 0 up to the first one that raises IndexError (or up to __len__, if you provide it, but that isn't necessary). But this doesn't have to be airtight for type proofs or anything; if your class inherits from Indexable but then accepts integers too large to fit in an Index, that's fine.
participants (4)
-
Alexander Walters
-
Andrew Barnert
-
Guido van Rossum
-
Nick Coghlan