classes and object-oriented programming each class definition begins with the reserved word class followed by the name of the class and some information about how it relates to other classes in this casethe first line indicates that intset is subclass of object for nowignore what it means to be subclass we will get to that shortly as we will seepython has number of special method names that start and end with two underscores the first of these we will look at is __init__ whenever class is instantiateda call is made to the __init__ method defined in that class when the line of code intset(is executedthe interpreter will create new instance of type intsetand then call intset __init__ with the newly created object as the actual parameter that is bound to the formal parameter self when invokedintset __init__ creates valsan object of type listwhich becomes part of the newly created instance of type intset (the list is created using the by now familiar notation []which is simply an abbreviation for list(this list is called data attribute of the instance of intset notice that each object of type intset will have different vals listas one would expect as we have seenmethods associated with an instance of class can be invoked using dot notation for examplethe codes intset( insert( print member( creates new instance of intsetinserts the integer into that intsetand then prints true at first blush there appears to be something inconsistent here it looks as if each method is being called with one argument too few for examplemember has two formal parametersbut we appear to be calling it with only one actual parameter this is an artifact of the dot notation the object associated with the expression preceding the dot is implicitly passed as the first parameter to the method throughout this bookwe follow the convention of using self as the name of the formal parameter to which this actual parameter is bound python programmers observe this convention almost universallyand we strongly suggest that you use it as well class should not be confused with instances of that classjust as an object of type list should not be confused with the list type attributes can be associated either with class itself or with instances of classmethod attributes are defined in class definitionfor example intset member is an attribute of the class intset when the class is instantiatede by intset()instance attributese memberare created keep in mind that intset member and member are different objects while member is initially bound to the member method defined in the class intsetthat binding can be changed during the course of computation for exampleyou could (but shouldn' !write member intset insert