Python _ builtins _ classmethod class (11 ),
11. For 'classmethod', the modifier's function does not need to be instantiated and the self parameter is not required. However, the first parameter must be the cls parameter representing its own class and can be used to call class attributes, class methods, instantiated objects, etc.
Class classmethod (object) | classmethod (function)-> method | Convert a function to be a class method. # converting A function into A class method | A class method when es the class as implicit first argument,
A class method. the receiving Class is used as an implicit parameter. | just like an instance method when es the instance.
Just like an instance method that receives an instance object | To declare a class method, use this idiom: | class C: | @ classmethod | def f (cls, arg1, arg2 ,...): |... | It can be called either on the class (e.g. c. f () or on an instance | (e.g. C (). f ()). the instance is ignored before t for its class.
You can call the f function using a class object or an instance object. | If a class method is called for a derived class, the derived class | object is passed as the implied first argument. | Class methods are different than C ++ or Java static methods. | If you want those, see the staticmethod builtin. | Methods defined here: | _ get _ (self, instance, owner,/) | Return an attribute of instance, which is of type owner. | _ init _ (self,/, * args, ** kwargs) | Initialize self. see help (type (self) for accurate signature. | _ new _ (* args, ** kwargs) from builtins. type | Create and return a new object. see help (type) for accurate signature. | ---------------------------------------------------------------------- | Data descriptors defined here: | _ dict _ | _ func _ | _ isactmethod __