Issue #6 new
from singledispatch import singledispatch @singledispatch def f(a): print('f', a) class C: pass f(C)
Traceback (most recent call last): File "singledispatch_old-style_classes.py", line 8, in <module> f(C) File "/usr/lib/python2.7/dist-packages/singledispatch.py", line 210, in wrapper return dispatch(args.__class__)(*args, **kw) AttributeError: class C has no attribute '__class__'
One obvious possible fix is to replace
type(args), which works on old-style classes. I don't know of any cases where
type(foo) isn't the same as
foo.__class__, though I can't guarantee they don't exist.