2 ms·
http://www.python.org/dev/peps/pep-3106/ http://www.python.org/dev/peps/pep-3106/ The original plan was to simply let .keys(), .values() and .items() retur
by pyre 14y ago
http://www.python.org/dev/peps/pep-3106/ http://www.python.org/dev/peps/pep-3106/
The original plan was to simply let .keys(), .values() and
.items() return an iterator, i.e. exactly what iterkeys(),
itervalues() and iteritems() return in Python 2.x.
However, the Java Collections Framework [1] suggests that
a better solution is possible: the methods return objects
with set behavior (for .keys() and .items()) or multiset
(== bag) behavior (for .values()) that do not contain
copies of the keys, values or items, but rather reference
the underlying dict and pull their values out of the dict
as needed.