ABCs : adding an implements alias ?

Hello I am playing with ABCs and I don't find the usage of the built-in issubclass() natural to test wheter a class implements an ABC. I think it's just the name of the built-in, or maybe the fact that it is hidden in the mro. (or maybe because I have used zope.interfaces a lot). What about introducing two aliases ? - implements, that points to issubclass - implemented_by, that points to __subclasshook__ So we could write things like :
Instead of:
Regards Tarek -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/

On Sat, Feb 21, 2009 at 6:40 AM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
Probably the latter. Please try getting used to it. Zope didn't choose its API because it was the best but because in the days issubclass() and isinstance() weren't overloadable. We have an API for this already, and it won't go away. No need to create another one. Remember TOOWTDI. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

Tarek Ziadé wrote:
I am playing with ABCs and I don't find the usage of the built-in issubclass() natural to test wheter a class implements an ABC.
One of the main points of ABCs, as I understand things, is so that you can declare a class as being a subclass of something "after the fact", and thus fool existing code that uses isinstance and issubclass tests into treating your objects in a duck-typed way. Requiring a different function to test for ABC inheritance would defeat that. -- Greg

On Sat, Feb 21, 2009 at 6:40 AM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
Probably the latter. Please try getting used to it. Zope didn't choose its API because it was the best but because in the days issubclass() and isinstance() weren't overloadable. We have an API for this already, and it won't go away. No need to create another one. Remember TOOWTDI. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

Tarek Ziadé wrote:
I am playing with ABCs and I don't find the usage of the built-in issubclass() natural to test wheter a class implements an ABC.
One of the main points of ABCs, as I understand things, is so that you can declare a class as being a subclass of something "after the fact", and thus fool existing code that uses isinstance and issubclass tests into treating your objects in a duck-typed way. Requiring a different function to test for ABC inheritance would defeat that. -- Greg
participants (3)
-
Greg Ewing
-
Guido van Rossum
-
Tarek Ziadé