mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
2-to-3 fixup for map() example in docs
This commit is contained in:
parent
20933e08b1
commit
d292a17fc7
1 changed files with 1 additions and 1 deletions
|
|
@ -387,7 +387,7 @@ expect a function argument.
|
|||
|
||||
>>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)]
|
||||
>>> getcount = itemgetter(1)
|
||||
>>> map(getcount, inventory)
|
||||
>>> list(map(getcount, inventory))
|
||||
[3, 2, 5, 1]
|
||||
>>> sorted(inventory, key=getcount)
|
||||
[('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue