summaryrefslogtreecommitdiff
path: root/django/utils/datastructures.py
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2007-11-12 03:12:47 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2007-11-12 03:12:47 +0000
commit5e8be6978e0881698f88ba6a23ed7e8fa9928c06 (patch)
tree4c533879625f4c9d453922d2743090fd16f86f3f /django/utils/datastructures.py
parenta4907be38ecc9f6caf3d2a787a7046af3f8b9ceb (diff)
downloaddjango-5e8be6978e0881698f88ba6a23ed7e8fa9928c06.tar.gz
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
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r--django/utils/datastructures.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index e0835b2cfc..549aa3f183 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -62,12 +62,10 @@ class SortedDict(dict):
else:
self.keyOrder = [key for key, value in data]
- def __deepcopy__(self,memo):
+ def __deepcopy__(self, memo):
from copy import deepcopy
- obj = self.__class__()
- for k, v in self.items():
- obj[k] = deepcopy(v, memo)
- return obj
+ return self.__class__([(key, deepcopy(value, memo))
+ for key, value in self.iteritems()])
def __setitem__(self, key, value):
dict.__setitem__(self, key, value)