nine classes classes provide means of bundling data and functionality together creating new class creates new type of objectallowing new instances of that type to be made each class instance can have attributes attached to it for maintaining its state class instances can also have methods (defined by its classfor modifying its state compared with other programming languagespython' class mechanism adds classes with minimum of new syntax and semantics it is mixture of the class mechanisms found in +and modula- python classes provide all the standard features of object oriented programmingthe class inheritance mechanism allows multiple base classesa derived class can override any methods of its base class or classesand method can call the method of base class with the same name objects can contain arbitrary amounts and kinds of data as is true for modulesclasses partake of the dynamic nature of pythonthey are created at runtimeand can be modified further after creation in +terminologynormally class members (including the data membersare public (except see below private variables)and all member functions are virtual as in modula- there are no shorthands for referencing the object' members from its methodsthe method function is declared with an explicit first argument representing the objectwhich is provided implicitly by the call as in smalltalkclasses themselves are objects this provides semantics for importing and renaming unlike +and modula- built-in types can be used as base classes for extension by the user alsolike in ++most built-in operators with special syntax (arithmetic operatorssubscripting etc can be redefined for class instances (lacking universally accepted terminology to talk about classesi will make occasional use of smalltalk and +terms would use modula- termssince its object-oriented semantics are closer to those of python than ++but expect that few readers have heard of it word about names and objects objects have individualityand multiple names (in multiple scopescan be bound to the same object this is known as aliasing in other languages this is usually not appreciated on first glance at pythonand can be safely ignored when dealing with immutable basic types (numbersstringstupleshoweveraliasing has possibly surprising effect on the semantics of python code involving mutable objects such as listsdictionariesand most other types this is usually used to the benefit of the programsince aliases behave like pointers in some respects for examplepassing an object is cheap since only pointer is passed by the implementationand if function modifies an object passed as an argumentthe caller will see the change -this eliminates the need for two different argument passing mechanisms as in pascal python scopes and namespaces before introducing classesi first have to tell you something about python' scope rules class definitions play some neat tricks with namespacesand you need to know how scopes and namespaces work to fully