Sorting a list
Ben Finney
bignose+hates-spam at benfinney.id.au
Thu Feb 1 17:00:09 EST 2007
John Salerno <johnjsal at NOSPAMgmail.com> writes:
> Ah, so simply using sort() [on a list of tuples] will default to the
> first element of each tuple?
More precisely, list.sort will ask the elements of the list to compare
themselves. Those elements are tuples; two tuples will compare based
on comparison of their corresponding elements.
--
\ "The cost of a thing is the amount of what I call life which is |
`\ required to be exchanged for it, immediately or in the long |
_o__) run." -- Henry David Thoreau |
Ben Finney
More information about the Python-list
mailing list