[docs] 4.7.5
Doug and Riekie Dorman
riekanddoug at gmail.com
Wed Jan 15 05:48:55 CET 2014
>>>pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
>>>pairs.sort(key=lambda pair: pair[1])
>>>pairs
[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
Should be:
>>>pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
>>>pairs.sort(key=lambda pairs: pairs[1])
>>>pairs
[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20140114/dfff80e2/attachment.html>
More information about the docs
mailing list