]> granicus.if.org Git - python/commitdiff
Remove the __iter__ method from the UserDict class -- it can silently
authorGuido van Rossum <guido@python.org>
Tue, 7 Aug 2001 17:40:42 +0000 (17:40 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 7 Aug 2001 17:40:42 +0000 (17:40 +0000)
break old code (in extreme cases).  See SF bug #448153.

Add a new subclass IterableUserDict that has the __iter__ method.

Note that for new projects, unless backwards compatibility with
pre-2.2 Python is required, subclassing 'dictionary' is recommended;
UserDict might become deprecated.

Lib/UserDict.py

index fbd601a88f5dee5f5fba597caf2449a64b294186..b806ac1603fb1a84a125c983040d293d081f6336 100644 (file)
@@ -47,5 +47,7 @@ class UserDict:
         return self.data.popitem()
     def __contains__(self, key):
         return key in self.data
+
+class IterableUserDict(UserDict):
     def __iter__(self):
         return iter(self.data)