2 ms·
> Another response from a different source. Having to include self as a method argument means that those are not methods, but static functions. This declaratio
by masklinn 14y ago
> Another response from a different source. Having to include self as a method argument means that those are not methods, but static functions.
This declaration makes no sense.
> This really means there isn't precisely methods at all
Of course there is:
>>> class Foo(object):
... def bar(self): return 42
...
>>> type(Foo().bar)
<type 'instancemethod'>
>>> m = Foo().bar
>>> m()
42
> If there is a valid reason for this, it would go a long way in explaining away one of the major reasons I dislike python.
I don't know (and don't really care) if you'll consider it "a valid reason", but here's GvR's reasoning: http://neopythonic.blogspot.be/2008/10/why-explicit-self-has-to-stay.html http://neopythonic.blogspot.be/2008/10/why-explicit-self-has...