[Tutor] Shelve & immutable objects
Keith Winston
keithwins at gmail.com
Wed Jan 1 08:06:42 CET 2014
So sorry, I hit return: here's the example:
import shelve
db = shelve.open('class-shelve')
sue = db['sue']
sue.giveRaise(.25)
db['sue'] = sue
tom = db['tom']
tom.giveRaise(.20)
db['tom'] = tom
db.close()
Is it possible to dispense with the assignment/reassignment and just use
(open shelve)
db['sue'].giveRaise(.25)
db['sue'].giveRaise(.25)
(close shelve)
or is the assignment (or bounding?) necessary to unshelve/reshelve the
items...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140101/7840b2dd/attachment.html>
More information about the Tutor
mailing list