diff options
author | Raymond Hettinger <python@rcn.com> | 2009-03-18 22:13:20 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-03-18 22:13:20 (GMT) |
commit | a61ae6922fbd0923c0a44bbed786d49333aeb002 (patch) | |
tree | 6d699690eda0daef26ffcf1a4b17eb5a51d2e6e4 | |
parent | 06919a177d30f4459323caa1106825a32c68bb2e (diff) | |
download | cpython-a61ae6922fbd0923c0a44bbed786d49333aeb002.zip cpython-a61ae6922fbd0923c0a44bbed786d49333aeb002.tar.gz cpython-a61ae6922fbd0923c0a44bbed786d49333aeb002.tar.bz2 |
Use mixin methods where possible. (2.7 only -- these don't all exist in 3.0)
-rw-r--r-- | Lib/collections.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index 0ff5673..430c59b 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -69,24 +69,13 @@ class OrderedDict(dict, MutableMapping): setdefault = MutableMapping.setdefault update = MutableMapping.update pop = MutableMapping.pop - - def keys(self): - return list(self.__keys) - - def values(self): - return map(self.__getitem__, self.__keys) - - def items(self): - return zip(self.__keys, self.values()) - - def iterkeys(self): - return iter(self.__keys) - - def itervalues(self): - return _imap(self.__getitem__, self.__keys) - - def iteritems(self): - return _izip(self.__keys, _imap(self.__getitem__, self.__keys)) + keys = MutableMapping.keys + values = MutableMapping.values + items = MutableMapping.items + iterkeys = MutableMapping.iterkeys + itervalues = MutableMapping.itervalues + iteritems = MutableMapping.iteritems + __ne__ = MutableMapping.__ne__ def __repr__(self): if not self: |