Message60629
| Author |
winjer |
| Recipients |
| Date |
2005年01月10日.21:28:19 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
I've got a class:
class odict(dict):
def __init__(self, d={}):
self._keys = d.keys()
dict.__init__(self, d)
def __setitem__(self, key, item):
dict.__setitem__(self, key, item)
if key not in self._keys:
self._keys.append(key)
...
When I copy.deepcopy one of these it blows up in
__setitem__ with an AttributeError on _keys, because
__setitem__ is called without __init__ ever having been
called. Presumably this thing looks and smells like a
dictionary, so deepcopy thinks it is one.
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2008年01月20日 09:57:24 | admin | link | issue1099746 messages |
| 2008年01月20日 09:57:24 | admin | create |
|