figure illustrates the method-calling sequence for this example notice how the method is called with one parameter (the value)but the method definition has two parametersdue to self generally speakingwe would say setvalue requires one parameter the self parameter in the definition is bookkeeping detail some languages do this implicitlypython requires us to add the extra parameter to avoid confusioni will always refer to the first formal parameter of method as the self parameter and any others as normal parameters soi would say setvalue uses one normal parameter class msdiedef main()die msdie( self=die value= def setvalue(self,value)die setvalue( self value value print die getvalue(figure flow of control in calldie setvalue( okso self is parameter that represents an object but what exactly can we do with itthe main thing to remember is that objects contain their own data conceptuallyinstance variables provide way to remember data inside an object just as with regular variablesinstance variables are accessed by name we can use our familiar dot notationlook at the definition of setvalueself value refers to the instance variable value that is associated with the object each instance of class has its own instance variablesso each msdie object has its very own value certain methods in class have special meaning to python these methods have names that begin and end with two underscores the special method __init__ is the object constructor python calls this method to initialize new msdie the role of __init__ is to provide initial values for the instance variables of an object from outside the classthe constructor is referred to by the class name die msdie( when executing this statementpython creates new msdie and executes __init__ on that object the net result is that die sides is set to and die value is set to the power of instance variables is that we can use them to remember the state of particular objectand this information then gets passed around the program as part of the object the values of instance variables can be referred to again in other methods or even in successive calls to the same method this is different from regular local function variableswhose values disappear once the function terminates here is simple illustrationdie die( print die getvalue( die setvalue(