mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
- PEP 3106: dict.iterkeys(), .iteritems(), .itervalues() are now gone;
and .keys(), .items(), .values() return dict views. The dict views aren't fully functional yet; in particular, they can't be compared to sets yet. but they are useful as "iterator wells". There are still 27 failing unit tests; I expect that many of these have fairly trivial fixes, but there are so many, I could use help.
This commit is contained in:
parent
4e66dfcdc4
commit
cc2b016125
73 changed files with 317 additions and 272 deletions
|
|
@ -790,7 +790,7 @@ Samuele
|
|||
|
||||
>>> from operator import itemgetter
|
||||
>>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3)
|
||||
>>> di = sorted(sorted(d.iteritems()), key=itemgetter(1))
|
||||
>>> di = sorted(sorted(d.items()), key=itemgetter(1))
|
||||
>>> for k, g in groupby(di, itemgetter(1)):
|
||||
... print(k, map(itemgetter(0), g))
|
||||
...
|
||||
|
|
@ -823,7 +823,7 @@ Samuele
|
|||
... return imap(function, count())
|
||||
|
||||
>>> def iteritems(mapping):
|
||||
... return izip(mapping.iterkeys(), mapping.itervalues())
|
||||
... return izip(mapping.keys(), mapping.values())
|
||||
|
||||
>>> def nth(iterable, n):
|
||||
... "Returns the nth item"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue