- class X:
- def fn1(self):
- def fn2():
- def __init__(self):
- self.value = 99
- x = X() # OK
- x.fn1() # OK
- X.fn1(x) # OK
- #X.fn1() # TypeError: fn1() missing 1 required positional argument: 'self'
- #x.fn2() # TypeError: fn2() takes 0 positional arguments but 1 was given
- X.fn2() # OK in 3.2, 2.7: TypeError: unbound method fn2() must be called with X instance as first argument (got nothing instead)
a guest Apr 24th, 2014 278 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data