Issue 13318: Shelve second tier array subscript "[ ]" key creation doesn't work (original) (raw)
Issue13318
Created on 2011-11-01 22:54 by cpiekarski, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (2) | ||
---|---|---|
msg146816 - (view) | Author: Chris Piekarski (cpiekarski) | Date: 2011-11-01 22:54 |
Shelve object second tier array subscript key generation doesn't behave the same way dictionary object do. >>> import shelve >>> x = shelve.open("tst1.shelve") >>> x["one"] = {} >>> x {'one': {}} >>> x["one"]["two"] = 2 >>> x {'one': {}} Whereas with a dictionary it works: >>> y = {} >>> y["one"] = {} >>> y["one"]["two"] = 2 >>> y {'one': {'two': 2}} | ||
msg146817 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2011-11-01 23:23 |
shelve is behaving as documented. Because the shelve dictionary entry is mutable (a dictionary), you need to set writeback=True to get the behavior you expect. http://docs.python.org/library/shelve.html |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:23 | admin | set | github: 57527 |
2011-11-01 23:23:59 | ned.deily | set | status: open -> closednosy: + ned.deilymessages: + resolution: not a bugstage: resolved |
2011-11-01 22:54:06 | cpiekarski | create |