[Python-ideas] Revisiting Immutable Mappings
chris.barker at noaa.gov
Thu Oct 18 15:35:36 EDT 2018
On Thu, Oct 18, 2018 at 10:12 AM, Sven R. Kunze <srkunze at mail.de> wrote:
> On 18.10.18 18:49, Anders Hovmöller wrote:
>> If it's AND, shouldn't it be "hasinterfaces" (notice the s!)?
yeah, that would make sense.
Is someone proposing something here? The point I was making, is in the case
isn't "Really" testing a subclass, but really an interface. That is - the
ABC exists solely to define an interface, not provide any functionality
(though there is some in there), and you can, in fact, use ABCs to provide
a way to check a duck-typed class that isn't an actual subclass.
So do we need a new function that makes that clear? would it functionally
be an different than issubclass with an ABC?
I honestly don't know.
Though an easy way to get the "and" behaviour -- i.e. interfaceS would be
To be sure, we are on the same page here: "interface" refers to a set of
> attributes of the object in question, does it?
> E.g. like the __iter__ iterface. I usually don't care about the actual
> inheritance hierarchy but care about functionality.
> One could also imagine that isinstance and issubclass taking a keyword
>> argument for the logical operator. Maybe just something as simple as
>> "isinstance(foo, (a, b), all=True)"
> Does AND even make sense for isinstance/issubclass?
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas