creating an artificial "last element" in sort list

dave davidreynon at gmail.com
Fri Sep 28 19:39:33 EDT 2012


a = ['a', 'b', x]

b = sorted(a)

What does x need to be to always be last on an ascending sort no matter what 'a' and 'b' are.... within reason... I am expecting 'a' and 'b' will be not longer than 10 char's long.... I tried making x = 'zzzzzzzzzzzzzzzz' and believe it or not, this appears FIRST on the sort!!!



More information about the Python-list mailing list