On 2019-09-29 21:15, Steven D'Aprano wrote:
Clearly we can't have an ABC for every imaginable combination of magic
methods. There would be hundreds. What would we name them?
We should (and do!) have ABCs for the most common combinations, like
Sequence, MutableMapping, Container etc.
And we shou
On Sep 29, 2019, at 16:41, Steven D'Aprano wrote:
>
>> On Sun, Sep 29, 2019 at 11:27:32AM +0100, Oscar Benjamin wrote:
>>
>> That's the point that I would make as well. What can you do with an
>> object that is only known to be Subscriptable?
>
> I can subscript it. What did you expect the answ
On Sun, Sep 29, 2019 at 09:05:19AM -0700, Christopher Barker wrote:
> And after this code is run, now what? you don't know anything about HOW you
> can subscript that object -- can you use an index, can you use a key, can
> you do something really wierd and arbitrary:
That applies to many interfa
On Sun, Sep 29, 2019 at 11:27:32AM +0100, Oscar Benjamin wrote:
> That's the point that I would make as well. What can you do with an
> object that is only known to be Subscriptable?
I can subscript it. What did you expect the answer to be?
If you want to know if an object has a length, you can
On Sun, Sep 29, 2019 at 5:04 AM Ricky Teachey wrote:
> That's the point that I would make as well. What can you do with an
>>
> object that is only known to be Subscriptable?
>>
>> def do_subscriptable_things(obj):
>> if isinstance(obj, Subscriptable):
>> # Now what?
>
>
I'm going to
>
> That's the point that I would make as well. What can you do with an
>
object that is only known to be Subscriptable?
>
> def do_subscriptable_things(obj):
> if isinstance(obj, Subscriptable):
> # Now what?
>
Maybe if you want to use/abuse it as an alternative function calling
synta
On Sun, 29 Sep 2019 at 08:28, Kyle Stanley 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 isola
> This supports my point that this ought to be handled once, correctly, in
the standard library, like the other ABCs, instead of leaving it up to
people like me to get it wrong.
It would be pretty reasonable to assume that most users would get
this incorrectly. My first assumption to this problem