2 ms·
> Why a self argument on every function? A self argument is on methods because then, from the inside, methods are identical to functions, rather than functions
by dragonwriter 6y ago
> Why a self argument on every function?
A self argument is on methods because then, from the inside, methods are identical to functions, rather than functions with additional implicit magic.
Also because it's a function member of the class with exactly that argument pattern; calling instance.method(...) is just syntax sugar for ClassOfInstance.method(instance, ...).
This also makes Python handling of unbound methods a lot cleaner than, say, Ruby.