From empirical testing, it seems that max() and min() in the list will return the first in the list, which corresponds to max() / min() in case of equality:
>>> test = [(1, "a"), (1, "b"), (2, "c"), (2, "d")] >>> max(test, key=lambda x: x[0]) (2, 'c') >>> test = [(1, "a"), (1, "b"), (2, "d"), (2, "c")] >>> max(test, key=lambda x: x[0]) (2, 'd') >>> min(test, key=lambda x: x[0]) (1, 'a') >>> test = [(1, "b"), (1, "a"), (2, "d"), (2, "c")] >>> min(test, key=lambda x: x[0]) (1, 'b')
And Jeremy is perfectly watching that this is true.
Daniel DiPaolo Jul 21 '11 at 21:30 2011-07-21 21:30
source share