On Thu, Oct 18, 2018 at 10:12 AM, Sven R. Kunze <srku...@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 of ABCs: issubclass(a_class, an_abc) 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 nice. -CHB 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? > > Cheers, > Sven > > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Christopher Barker, Ph.D. Oceanographer 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.bar...@noaa.gov
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/