class methods operate on the class itselfnot the instancein the same way that class variables are associated with the classes rather than instances of that class they are defined using the @classmethod decoratorand are distinguished from instance methods in that the class is passed as the first argument this is named cls by convention class aexp(object)base= @classmethod def exp(cls, )return(cls base**xclass bexp(aexp)base= the class bexp inherits from the aexp class and changes the base class variable to we can run the parent class' exp(method as followsalthough this example is little contrivedthere are several reasons why class methods may be useful for examplebecause subclass inherits all the same features of its parentthere is the potential for it to break inherited methods using class methods is way to define exactly what methods are run data encapsulation and properties unless otherwise specifiedall attributes and methods are accessible without restriction this also means that everything defined in base class is accessible from derived class this may cause problems when we are building object-oriented applications where we may want to hide the internal implementation of an object this can lead to namespace conflicts between objects defined in derived classes with the base class to prevent thisthe methods we define private attributes with have double underscoresuch as __privatemethod(these method names are automatically changed to _classname__privatemethod(to prevent name conflicts with methods defined in base classes be aware that this does not strictly hide private attributesrather it just provides mechanism for preventing name conflicts