3 ms·
You can rename self to whatever you want in Python by changing it in the function definition. class Flip(object): foo=4 def flop(x,num):
by code_duck 16y ago
You can rename self to whatever you want in Python by changing it in the function definition.
class Flip(object):
foo=4
def flop(x,num):
x.bar=x.foo+num
- xiongchiamiov 16y agoRight, but his point was that the self variable is declared in front of the method name, similarly to how it looks when you call said method.