Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 5e8be6978e0881698f88ba6a23ed7e8fa9928c06 1 parent a4907be
Gary Wilson Jr. authored

Showing 1 changed file with 3 additions and 5 deletions. Show diff stats Hide diff stats

  1. 8  django/utils/datastructures.py
8  django/utils/datastructures.py
@@ -62,12 +62,10 @@ def __init__(self, data=None):
62 62
         else:
63 63
             self.keyOrder = [key for key, value in data]
64 64
 
65  
-    def __deepcopy__(self,memo):
  65
+    def __deepcopy__(self, memo):
66 66
         from copy import deepcopy
67  
-        obj = self.__class__()
68  
-        for k, v in self.items():
69  
-            obj[k] = deepcopy(v, memo)
70  
-        return obj
  67
+        return self.__class__([(key, deepcopy(value, memo))
  68
+                               for key, value in self.iteritems()])
71 69
 
72 70
     def __setitem__(self, key, value):
73 71
         dict.__setitem__(self, key, value)

0 notes on commit 5e8be69

Please sign in to comment.
Something went wrong with that request. Please try again.