summaryrefslogtreecommitdiffstats
path: root/Lib/UserDict.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-04-21 09:13:15 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-04-21 09:13:15 (GMT)
commita3f98d6bac3fbfc0e010360b11793bbd8a8f4c85 (patch)
tree5486edd566e74a59ec25420ad07e79d92b0349d7 /Lib/UserDict.py
parente99b97e58a274eb61d7346e786ad242e5253d3db (diff)
downloadcpython-a3f98d6bac3fbfc0e010360b11793bbd8a8f4c85.zip
cpython-a3f98d6bac3fbfc0e010360b11793bbd8a8f4c85.tar.gz
cpython-a3f98d6bac3fbfc0e010360b11793bbd8a8f4c85.tar.bz2
Give UserDict new __contains__ and __iter__ methods.
Diffstat (limited to 'Lib/UserDict.py')
-rw-r--r--Lib/UserDict.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/UserDict.py b/Lib/UserDict.py
index b642db7..bbd4ca0 100644
--- a/Lib/UserDict.py
+++ b/Lib/UserDict.py
@@ -40,3 +40,7 @@ class UserDict:
return self.data[key]
def popitem(self):
return self.data.popitem()
+ def __contains__(self, key):
+ return key in self.data
+ def __iter__(self):
+ return iter(self.data)