Eryk Sun added the comment: The register() method should raise a TypeError if it's called with an object that's not a type.
Consider the following: from functools import singledispatch class C: pass obj = C() @singledispatch def foo(x): print(foo.dispatch(x)) print("foo") @foo.register(obj) def bar(x): print(foo.dispatch(x)) print("bar") >>> foo(obj) <function bar at 0x7f16f2adc9d8> foo ---------- nosy: +eryksun title: singledispatch is wonky with enums -> singledispatch register should typecheck its argument versions: +Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27984> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com