[issue27984] singledispatch is wonky with enums

2016-09-06 Thread Ethan Furman
Ethan Furman added the comment: > IS = Enum("IS", "a, b") functools is meant to work with types, but the enum member "IS.a" is not a type -- however, the enum "IS" is a type. Use "foo.register(IS)" instead. -- nosy: +ncoghlan, rhettinger ___

[issue27984] singledispatch is wonky with enums

2016-09-06 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker ___ ___

[issue27984] singledispatch is wonky with enums

2016-09-06 Thread Anselm Kiefner
New submission from Anselm Kiefner: from functools import singledispatch from enum import Enum IS = Enum("IS", "a, b") @singledispatch def foo(x): print(foo.dispatch(x)) print("foo") @foo.register(IS.a) def bar(x): print(foo.dispatch(x)) print("bar") @foo.register(int)