Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test(object):
- def test(self, a, b=None):
- if isinstance(self, Test):
- return a + b
- else:
- return self + a
- >>> Test.test(1,2)
- 3
- >>> Test().test(1,2)
- 3
- TypeError: unbound method test() must be called with Test instance as first argument (got int instance instead)
Add Comment
Please, Sign In to add comment