One of the 50 questions in this topic
How much do you know about Python?A class method is defined with the @classmethod decorator and automatically receives the class (cls) as the first parameter instead of the instance (self). You can access and modify class attributes but not instance attributes. They are useful for alternative factory methods, for modifying shared class state between all instances, and for creating methods that work with inheritance more intuitively than static methods.