On Sun, 29 Sep 2019 at 08:28, Kyle Stanley <aeros...@gmail.com> wrote:
>
> Raymond also brought up a strong point to consider in
> https://bugs.python.org/issue25988:
>
> > The OP has a sense that Mapping and Sequence are "too heavy"
> but I think the reality that useful classes almost never use
> __getitem__ in isolation; rather, it is part of a small constellation
> of methods that are typically used together.

That's the point that I would make as well. What can you do with an
object that is only known to be Subscriptable?

With a Mapping I know that `keys` or `__iter__` give me the subscripts
that can be used with it. With a Sequence `__len__` tells me the valid
subscripts. Either of those makes it possible for me to build a
sensible algorithm using subscripts. Without either of those what can
I do in practice in a situation like this:

def do_subscriptable_things(obj):
    if isinstance(obj, Subscriptable):
        # Now what?

--
Oscar
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/S22PL4VQQWGPLXTRLEQTSLSTWHFM7CW3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to