3 ms·
Interestingly you can do this: class Foo: def bar(self): return "bar" foo = Foo() foo.bar() # returns "bar" Foo.bar(f
by arxanas 14y ago
Interestingly you can do this:
class Foo:
def bar(self):
return "bar"
foo = Foo()
foo.bar() # returns "bar"
Foo.bar(foo) # returns "bar"
So it's not actually specifying `self` for instance methods; it's just a special thing about class instances that calling a method will call its class's method passing the instance as the first argument.
After realizing this, I was enlightened.