On Sat, May 21, 2011 at 10:03 AM, Eric Snow <
ericsnowcurrently@gmail.com> wrote:
> This is a small addition, but I realize it [potentially] adds another
> special method to classes, so it's not trivial.
> 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. I don't have a programmatic way of discovering that set without
> asking every class out there. This is an easy way to accomplish this (for
> non-extension/non-builtin types). An alternative is to subclass ABCMeta and
> tack this on, but that only works for my ABCs. Another is to use a class
> decorator to do this any place I do a register (or even to do the register
> too), but again, only for the places that I do the registration.
> Anyway, if it's useful to me then it may be useful to others, so I wanted to
> put this out there. I expect this has come up before, particularly during
> discussions about PEP 3119. However, I wasn't able to track down anything
> specifically about doing this sort of "reverse registration". And, of
> course, I may be overestimating the value of this functionality. If this
> does not seem that valuable to anyone else, then no big deal. :)
An alternative approach to the same idea was to be able to register