If I write this:
class A:
def a(self):
return 2
def b(self):
print(self.a())
e = A()
def xa(self):
return 3
e.a = xa
e.b()
will explode saying that:
TypeError: xa() missing 1 required positional argument: 'self'
why does this happen? (if xa has no arguments then it works, printing 3, but then I can't access self).
This is for testing purposes, not actual production code