No, tuples are sequence types just like strings. They are sorted the same way, comparing each item in turn:
>>> import random >>> sorted([(0,0,0,int(random.getrandbits(4))) for x in xrange(10)]) [(0, 0, 0, 0), (0, 0, 0, 4), (0, 0, 0, 5), (0, 0, 0, 7), (0, 0, 0, 8), (0, 0, 0, 9), (0, 0, 0, 12), (0, 0, 0, 12), (0, 0, 0, 12), (0, 0, 0, 14)]
Three zeros are only there to show that something other than the first element needs to be checked.
unwind Mar 13 '09 at 19:13 2009-03-13 19:13
source share