summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-06-07 17:03:28 (GMT)
committerGeorg Brandl <georg@python.org>2008-06-07 17:03:28 (GMT)
commit60fbf7f8bb83dd10a8d71ae763f845e688399fa0 (patch)
tree3980ea930c56df71df0ec6c89a0bf314eb28eeeb /Lib/_abcoll.py
parent3bed4aeea52ece30c2a237ab7b92f611b0052284 (diff)
downloadcpython-60fbf7f8bb83dd10a8d71ae763f845e688399fa0.zip
cpython-60fbf7f8bb83dd10a8d71ae763f845e688399fa0.tar.gz
cpython-60fbf7f8bb83dd10a8d71ae763f845e688399fa0.tar.bz2
#3057: Fix the MutableMapping ABC to use the 2.6 dict interface.
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 856a816..5acbb70 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -329,14 +329,25 @@ class Mapping(Sized, Iterable, Container):
else:
return True
+ def iterkeys(self):
+ return iter(self)
+
+ def itervalues(self):
+ for key in self:
+ yield self[key]
+
+ def iteritems(self):
+ for key in self:
+ yield (key, self[key])
+
def keys(self):
- return KeysView(self)
+ return list(self)
def items(self):
- return ItemsView(self)
+ return [(key, self[key]) for key in self]
def values(self):
- return ValuesView(self)
+ return [self[key] for key in self]
def __eq__(self, other):
return isinstance(other, Mapping) and \
@@ -363,8 +374,6 @@ class KeysView(MappingView, Set):
for key in self._mapping:
yield key
-KeysView.register(type({}.keys()))
-
class ItemsView(MappingView, Set):
@@ -381,8 +390,6 @@ class ItemsView(MappingView, Set):
for key in self._mapping:
yield (key, self._mapping[key])
-ItemsView.register(type({}.items()))
-
class ValuesView(MappingView):
@@ -396,8 +403,6 @@ class ValuesView(MappingView):
for key in self._mapping:
yield self._mapping[key]
-ValuesView.register(type({}.values()))
-
class MutableMapping(Mapping):