Why can't I pass self as a named argument to an instance method in Python?
- by Joseph Garvin
This works:
>>> def bar(x, y):
... print x, y
...
>>> bar(y=3, x=1)
1 3
And this works:
>>> class foo(object):
... def bar(self, x, y):
... print x, y
...
>>> z = foo()
>>> z.bar(y=3, x=1)
1 3
And even this works:
>>> foo.bar(z, y=3, x=1)
1 3
But why doesn't this…