Re: [Python-Dev] ABCs and MRO

At 09:14 PM 3/2/2009 +0000, Paul Moore wrote:
2009/3/2 Jeffrey Yasskin <jyasskin@gmail.com>:
I tend to think it's a bug in ABCs. You seem to have thought of several possible ways to fix it, and I don't have strong preferences between them.
I've discussed ways of fixing simplegeneric, but not of fixing the issue with ABCs. I'm not sure the ABC "issue" is fixable - after all, it's by design that ABCs can implement __issubclass__ and "magically" become superclasses of arbitrary classes as a result.
I'm not happy about fixing simplegeneric, though, as the whole point was just to expose an existing implementation, because it might be generally useful. If we start expanding and enhancing it, there are better implementations already available on PyPI (better in the sense of having seen real-world use). And if they don't handle ABCs, then that might indicate that needing to handle ABCs isn't as vital as this discussion would seem to imply (but I have no real-world data myself to make such a claim).
I would say it's mainly an annoyance, as long as you have a way to access the method registered for a given ABC, because then you can explicitly register it for types that are being dynamically detected. Now, how widespread an annoyance/FAQ issue it'll be, will depend on: 1. whether the stdlib itself is using GF's and 2. whether those GF's are meaningfully used against ABCs, and 3. how common it is for classes to be "implicit subclasses" of one of those ABCs *and* used with one of those GFs. This sounds like a lot of conditions that have to line up, for it to become an (easily worked-around) annoyance. My inclination is simply to document that it works on explicit type relationships, and note that ABC's and other exotic users of __*check__ methods may require explicit method registrations to work correctly.
participants (1)
-
P.J. Eby