shelve
emf
news at mindlace.net
Thu Nov 15 18:05:08 EST 2001
# I don't understand why bar isn't being updated,
# or what I need to do to make it be updated...
import shelve
class foo:
def __init__(self):
self.bar = 0
class spam:
def __init__(self):
self.shelf = shelve.open('test')
self.shelf['a'] = foo()
def addOne(self):
self.shelf['a'].bar = 1
def printA(self):
print self.shelf['a'].bar
if __name__ == '__main__':
b = spam()
b.addOne()
b.printA()
More information about the Python-list
mailing list