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

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to