Simplified `SortedDict.__deepcopy__` now that the its constructor can take a sequence of tuples.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6669 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a4907be38e
commit
5e8be6978e
|
@ -62,12 +62,10 @@ class SortedDict(dict):
|
||||||
else:
|
else:
|
||||||
self.keyOrder = [key for key, value in data]
|
self.keyOrder = [key for key, value in data]
|
||||||
|
|
||||||
def __deepcopy__(self,memo):
|
def __deepcopy__(self, memo):
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
obj = self.__class__()
|
return self.__class__([(key, deepcopy(value, memo))
|
||||||
for k, v in self.items():
|
for key, value in self.iteritems()])
|
||||||
obj[k] = deepcopy(v, memo)
|
|
||||||
return obj
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
dict.__setitem__(self, key, value)
|
dict.__setitem__(self, key, value)
|
||||||
|
|
Loading…
Reference in New Issue