[Python-ideas] Revisiting Immutable Mappings

Sven R. Kunze srkunze at mail.de
Thu Oct 18 12:20:38 EDT 2018


On 12.10.18 01:30, Chris Barker via Python-ideas wrote:
> If Python had a way to check ABCs without issubclass, then I wouldn't 
> care about subclasses at all. I'd actually kind of like to have:
>
> hasinterface(an_object, (ABC1, ABC2, ABC3))


I actually like your idea and could imagine using "hasinterface" as some 
asserts. Great idea. +1


> Even though, it would be the same as issubclass() (though I'd like an 
> AND relationship with the tuple of ABCs..)


When "hasinterface" ANDs the tuple, it's already different, isn't it?


Btw., issubclass would require a class, not an instance. hasinterface, 
though, would work on all type of objects.


Best,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181018/c06b2997/attachment.html>


More information about the Python-ideas mailing list