[Python-ideas] __implements__ on arguments to ABCMeta.register

Eric Snow ericsnowcurrently at gmail.com
Tue May 24 03:21:05 CEST 2011


On Mon, May 23, 2011 at 6:54 PM, Daniel Stutzbach <stutzbach at google.com>wrote:

> On Fri, May 20, 2011 at 5:03 PM, Eric Snow <ericsnowcurrently at gmail.com>wrote:
>>
>> The use case is that I want to be able to validate that a class implements
>> all of the abstract methods of all the classes to which it has been
>> registered.
>>
>
> If you're going down that road, would you be willing to write a patch for
> http://bugs.python.org/issue9731 along the way?
>
>
>>
Interesting.  I was motivated in a similar situation to write a validater in
the same vein [1].  In fact, working on that is where I got thinking about
something like __implements__.  The class I wrote would work with registered
classes in addition to subclasses, if there were such a mechanism.

-eric


[1]
http://code.activestate.com/recipes/577711-validating-classes-and-objects-against-an-abstract/



> I don't have a programmatic way of discovering that set without asking
>> every class out there.
>>
>
> I agree it would be nice to have a way to ask a class "which ABCs do you
> implement?"  It would be handy for introspection and debugging purposes.
>
> --
> Daniel Stutzbach
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110523/ab416129/attachment.html>


More information about the Python-ideas mailing list