[Python-checkins] r64018 - python/trunk/Lib/_abcoll.py
georg.brandl
python-checkins at python.org
Sat Jun 7 19:03:28 CEST 2008
Author: georg.brandl
Date: Sat Jun 7 19:03:28 2008
New Revision: 64018
Log:
#3057: Fix the MutableMapping ABC to use the 2.6 dict interface.
Modified:
python/trunk/Lib/_abcoll.py
Modified: python/trunk/Lib/_abcoll.py
==============================================================================
--- python/trunk/Lib/_abcoll.py (original)
+++ python/trunk/Lib/_abcoll.py Sat Jun 7 19:03:28 2008
@@ -329,14 +329,25 @@
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 @@
for key in self._mapping:
yield key
-KeysView.register(type({}.keys()))
-
class ItemsView(MappingView, Set):
@@ -381,8 +390,6 @@
for key in self._mapping:
yield (key, self._mapping[key])
-ItemsView.register(type({}.items()))
-
class ValuesView(MappingView):
@@ -396,8 +403,6 @@
for key in self._mapping:
yield self._mapping[key]
-ValuesView.register(type({}.values()))
-
class MutableMapping(Mapping):
More information about the Python-checkins
mailing list