[Tutor] 4.7.5
Doug and Riekie Dorman
riekanddoug at gmail.com
Mon Jan 20 02:16:42 CET 2014
I think I may have found a bug:
>>>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')]
I have increased the size of the two s's to show the problem.
Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140119/e3a0bd4d/attachment.html>
More information about the Tutor
mailing list