3 ms·
Your `f` is not a method, but a top-level function whose first parameter happens to be named `self`. You can't call `f` as a method of any object, because in P
by bakery2k 8y ago
Your `f` is not a method, but a top-level function whose first parameter happens to be named `self`.
You can't call `f` as a method of any object, because in Python (unlike Ruby) the top-level namespace is unrelated to the namespaces of any classes.
- brudgers 8y agoI don't disagree. I just think it's much worse than that. There is no scope in Python where I can define 'f' to allow '(3).f'. I cannot restrict a function to the domain of Integers using encapsulation. I am forced to put it in some other arbitrary namespace.