from the shelve or run their methods when instances are shelved or pickledthe underlying pickling system records both instance attributes and enough information to locate their classes automatically when they are later fetched (the class' module simply has to be on the module search path when an instance is loadedthis is on purposebecause the class and its instances in the shelve are stored separatelyyou can change the class to modify the way stored instances are interpreted when loaded (more on this later in the bookhere is the shelve dump script' output just after creating the shelve with the maker scriptbob =bob smith sue =sue jones tom =tom doe smith doe as shown in example - database updates are as simple as before (compare this to example - )but dictionary keys become attributes of instance objectsand updates are implemented by class method calls instead of hardcoded logic notice how we still fetchupdateand reassign to keys to update the shelve example - pp \preview\update_db_classes py import shelve db shelve open('class-shelve'sue db['sue'sue giveraise db['sue'sue tom db['tom'tom giveraise db['tom'tom db close(and last but not leasthere is the dump script again after running the update scripttom and sue have new pay valuesbecause these objects are now persistent in the shelve we could also open and inspect the shelve by typing code at python' interactive command linedespite its longevitythe shelve is just python object containing python objects bob =bob smith sue =sue jones tom =tom doe smith doe step stepping up to oop