instance objects created from classes are new namespacesthey start out empty but inherit attributes that live in the class objects from which they were generated assignments to attributes of self in methods make per-instance attributes inside class' method functionsthe first argument (called self by conventionreferences the instance object being processedassignments to attributes of self create or change data in the instancenot the class the end result is that classes define commonshared data and behaviorand generate instances instances reflect concrete application entitiesand record per-instance data that may vary per object first example let' turn to real example to show how these ideas work in practice to beginlet' define class named firstclass by running python class statement interactivelyclass firstclassdef setdata(selfvalue)self data value def display(self)print(self datadefine class object define class' methods self is the instance self dataper instance we're working interactively herebut typicallysuch statement would be run when the module file it is coded in is imported like functions created with defsthis class won' even exist until python reaches and runs this statement like all compound statementsthe class starts with header line that lists the class namefollowed by body of one or more nested and (usuallyindented statements herethe nested statements are defsthey define functions that implement the behavior the class means to export as we learned in part ivdef is really an assignment hereit assigns function objects to the names setdata and display in the class statement' scopeand so generates attributes attached to the class--firstclass setdata and firstclass display in factany name assigned at the top level of the class' nested block becomes an attribute of the class functions inside class are usually called methods they're coded with normal defsand they support everything we've learned about functions already (they can have defaultsreturn valuesyield items on requestand so onbut in method functionthe first argument automatically receives an implied instance object when called--the subject of the call we need to create couple of instances to see how this worksx firstclass( firstclass(make two instances each is new namespace by calling the class this way (notice the parentheses)we generate instance objectswhich are just namespaces that have access to their classesattributes properly speakclasses generate multiple instance objects