MyClass.f refers to the function object f, which is a property of MyClass. In your case, f is an instance method (has a self parameter), so a specific instance invokes it. Its "unrelated" because you mean f without specifying a particular class, sort of referring to a steering wheel without a car.
You can create an instance of MyClass and call f from it like this:
x = MyClass() xf()
(This indicates which instance calls f, so you can refer to instance variables, etc.)
You use f as a static method . These methods are not bound to a specific class and can only refer to their parameters.
The static method will be created and used like this:
class MyClass(object): def f():
Gordon gustafson
source share