method overloading with wrapper classes
I'm a little bit surprised that there isn't a way to do this natively in Python. I'm creating a wrapper class W to support the kind of features I want out of a pre-existing class C. This new wrapper class W should still support some of the same operations in C. For example, if C has a method "foo(self, <argument of type C>)", then I would want an equivalent method "foo(self, ...)" in class W. At this point I've immediately hit a wall because Python doesn't support method overloading. I want W to have a method foo which works just as well on arguments of type W as on arguments of type C. So I want two methods with the same name:
foo(self, <argument of type C>)
and
foo(self, <argument of type W>)
Manually checking the type using isinstance is ugly and apparently not Pythonic. Plus, what if I have to do this for several functions? I would be repeating the same argument checking logic within each function? That's terrible. The best solution I can find online is to use singledispatch from functools?
How would you handle this particular implementation?