Message 83009 - Python tracker (original) (raw)
The problem with generic functions supporting ABCs is it's a bug with the way ABCs work and not a problem with the generic function implementation. The register() method of an ABC only fakes out isinstance checks, it doesn't actually make the abstract base class a base class of the class. It doesn't make any sense for a class to say it is an instance of an ABC, but not have that ABC in it's MRO. It's not a base class if it's not in the MRO!
The documentation for lack of ABC support should read something like:
- Note that generic functions do not work with classes which have
- been declared as an abstract base class using the
- abc.ABCMeta.register() method because this method doesn't make
- that abstract base class a base class of the class - it only fakes
- out instance checks.
Perhaps a bug should be opened for the abc.ABCMeta.register() method.
However, I'd say that just because virtual abstract base classes are wonky doesn't mean that a solid generic function implementation shouldn't be added to standard library.