How is f different from g? Exactly, Demo.f works but Demo.g does not. I am pretty sure both get the self parameter, but what happens to it in the f case? (I have more tests but they show the same result.)
f = int
def g(x):
return int(x)
class Demo():
def this_works(self, n):
return int(n)
def not_this(self, m):
return int(self, m)
Demo.this_also = Demo.this_works
Demo.surprisingly = int
Demo.f = f
Demo.g = g
d = Demo()
n=0
for af in [d.this_works, d.this_also, d.not_this, d.f, d.g]:
n += 1
print(f'Test #{n} of {str(af)}')
try:
print(af(str(n)))
except TypeError as e:
print(f'Failed with {e}')