appendix classes pointa getx( pointa gety(print"(str( "str( ")when the getx(method is calledpython creates local variable for the self parameter and assigns it copy of the reference stored in pointaas illustrated by figure the body of the method is then executed since the instance variable is prepended with the self reference and self is an alias for pointathe value in the xcoord attribute of pointa will be returned pointa xcoord pointa getx(ycoord self pointb xcoord ycoord the local scope for this method invocation figure use of the self reference any object that stores data is said to have state the object' state is the current set of values that it contains objects are divided into two distinct categoriesmutable and immutable an immutable object is one in which the state cannot be changed once it has been created if the data fields of the object can be changed after the object has been createdthe object is said to be mutable so farthe objects created from our point class are immutable because we have no way of changing the coordinates stored in the objects we can add method to adjust or shift point along both the xand -axeswhich now makes our objects mutable since we have way to modify the data attributesclass point def shiftselfxincyinc )self xcoord +xinc self ycoord +yinc if we apply this new method to our pointa object with the method call pointa shift( )local variables are created for all three parameters and assigned the corresponding valuesas illustrated in the top of figure after the method is executedthe data attributes of the pointa object are modifiedas illustrated in the bottom of figure finallywe add method to our class that can be used to compute the euclidean distance between two instances of the point classclass point def distanceselfotherpoint )xdiff self xcoord otherpoint xcoord ydiff self ycoord otherpoint ycoord return math sqrtxdiff * ydiff *