by stamping on their data attributes note that clients may add data attributes of their own to an instance object without affecting the validity of the methodsas long as name conflicts are avoided -againa naming convention can save lot of headaches here there is no shorthand for referencing data attributes (or other methods!from within methods find that this actually increases the readability of methodsthere is no chance of confusing local variables and instance variables when glancing through method oftenthe first argument of method is called self this is nothing more than conventionthe name self has absolutely no special meaning to python notehoweverthat by not following the convention your code may be less readable to other python programmersand it is also conceivable that class browser program might be written that relies upon such convention any function object that is class attribute defines method for instances of that class it is not necessary that the function definition is textually enclosed in the class definitionassigning function object to local variable in the class is also ok for examplefunction defined outside the class def (selfxy)return min(xx+yclass cf def (self)return 'hello worldh now fg and are all attributes of class that refer to function objectsand consequently they are all methods of instances of - being exactly equivalent to note that this practice usually only serves to confuse the reader of program methods may call other methods by using method attributes of the self argumentclass bagdef __init__(self)self data [def add(selfx)self data append(xdef addtwice(selfx)self add(xself add(xmethods may reference global names in the same way as ordinary functions the global scope associated with method is the module containing its definition ( class is never used as global scope while one rarely encounters good reason for using global data in methodthere are many legitimate uses of the global scopefor one thingfunctions and modules imported into the global scope can be used by methodsas well as functions and classes defined in it usuallythe class containing the method is itself defined in this global scopeand in the next section we'll find some good reasons why method would want to reference its own class each value is an objectand therefore has class (also called its typeit is stored as object __class__ classes