[Python-ideas] Re: Add Subscriptable ABC

2019-09-30 Thread Stephen J. Turnbull
Steven D'Aprano writes: > 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? Technical que

[Python-ideas] Re: Add Subscriptable ABC

2019-09-30 Thread Paul Moore
On Mon, 30 Sep 2019 at 10:02, Stephen J. Turnbull wrote: > > Steven D'Aprano writes: > > 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? > > > >

[Python-ideas] Re: Add Subscriptable ABC

2019-09-30 Thread Andrew Barnert via Python-ideas
On Sep 30, 2019, at 02:38, Paul Moore wrote: > > It's (in my view) sad that the simple hasattr test is no longer > sufficient, and in particular that if you want robustness, Python has > changed to the point where a pseudo subclass check is the "right" way > to check for an object that has certai

[Python-ideas] Re: Add Subscriptable ABC

2019-09-30 Thread Christopher Barker
> > > > That applies to many interface checks. Both the built-in callable() and > the Callable ABC don't tell you what arguments the object accepts, or > what it does; the Sequence ABC check doesn't tell you what valid indexes > are accepted. Sure — and Callable is probably the closest ABC to thi

[Python-ideas] Re: Add Subscriptable ABC

2019-09-30 Thread Ben Rudiak-Gould
On Mon, Sep 30, 2019 at 10:08 AM Andrew Barnert via Python-ideas wrote: > Also, what we’re checking for really is subtyping. Is it? Subtyping in type theory satisfies some axioms, one of which is transitivity. The addition of the ABCs broke transitivity: >>> issubclass(list, object) True