[issue5135] Expose simplegeneric function in functools module

Kevin Teague report at bugs.python.org
Mon Mar 2 10:39:12 CET 2009


Kevin Teague <kevin at bud.ca> added the comment:

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.

----------
nosy: +kteague

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5135>
_______________________________________


More information about the Python-bugs-list mailing list