"for free"--printing our objects automatically employs the general __repr__ overloading methodand we give raises by calling the giveraise method we wrote earlier this all "just worksfor objects based on oop' inheritance modeleven when they live in filefile updatedb pyupdate person object on database import shelve db shelve open('persondb'reopen shelve with same filename for key in sorted(db)print(key'\ =>'db[key]iterate to display database objects prints with custom format sue db['sue jones'sue giveraise db['sue jones'sue db close(index by key to fetch update in memory using class' method assign to key to update in shelve close after making changes because this script prints the database when it starts upwe have to run it at least twice to see our objects change here it is in actiondisplaying all records and increasing sue' pay each time it is run (it' pretty good script for sue something to schedule to run regularly as cron job perhaps?) :\codeupdatedb py bob smith =[personjob=nonename=bob smithpay= sue jones =[personjob=devname=sue jonespay= tom jones =[managerjob=mgrname=tom jonespay= :\codeupdatedb py bob smith =[personjob=nonename=bob smithpay= sue jones =[personjob=devname=sue jonespay= tom jones =[managerjob=mgrname=tom jonespay= :\codeupdatedb py bob smith =[personjob=nonename=bob smithpay= sue jones =[personjob=devname=sue jonespay= tom jones =[managerjob=mgrname=tom jonespay= :\codeupdatedb py bob smith =[personjob=nonename=bob smithpay= sue jones =[personjob=devname=sue jonespay= tom jones =[managerjob=mgrname=tom jonespay= againwhat we see here is product of the shelve and pickle tools we get from pythonand of the behavior we coded in our classes ourselves and once againwe can verify our script' work at the interactive prompt--the shelve' equivalent of database clientc:\codepython import shelve db shelve open('persondb'reopen database rec db['sue jones'fetch object by key rec [personjob=devname=sue jonespay= more realistic example