@classmethod |
Returns test |
REMARKS |
* No prefix required - Core * Transform a method into a class method. * A class method receives the class as an implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom: * The @classmethod form is a function decorator - see Function definitions for details. * A class method can be called either on the class (such as C.f()) or on an instance (such as C().f()). The instance is ignored except for its class. 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 staticmethod() in this section. For more information on class methods, see The standard type hierarchy. * Class methods inherit the method attributes (__module__, __name__, __qualname__, __doc__ and __annotations__) and have a new __wrapped__ attribute. |
class C:
@classmethod
def f(cls, arg1, arg2): ...
© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited Top