I\'m trying to sort a list and I can\'t figure out to reverse the order of a second sorting characteristic.
import math
ps = {1:(1,1),2:(3,2),3:(3,-3),4:(-3,4),
You can do two sorts, least significant first. Python sorting is stable, so the order determined by the first sort will hold when you do the second.
for c in sorted(sorted(l, key = lambda t:math.sqrt((0-t[1][0])**2 + (0-t[1][1])**2)), key = lambda t:t[0], reverse=True):
This method works even when the keys aren't numeric.