[issue36457] functools.singledispatchmethod interacts poorly with subclasses
Tim Mitchell
report at bugs.python.org
Fri Apr 12 00:43:16 EDT 2019
Tim Mitchell <tim.mitchell at seequent.com> added the comment:
Attached is an improved implementation that does not use a module level register() function.
It makes the code in the original post work as expected: The `@BaseVisitor.visit.register()` decorator on the `AVisitor` class does not modify the base class dispatch table. This works by constructing the dispatch registry in the `__init_subclass__` method instead.
----------
Added file: https://bugs.python.org/file48261/singledispatchmethod.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36457>
_______________________________________
More information about the Python-bugs-list
mailing list