Hello list, I'm having trouble with a incredibly simple sort of a list containing ints and tuples:
def myorder(x): if type(x) == int: return x else: return x[0] odata = sorted([ (a, b) for (a, b) in data["description"].items() ], key=myorder) still says: Traceback (most recent call last): File "./genproto.py", line 81, in <module> odata = sorted([ (a, b) for (a, b) in data["description"].items() ], key=myorder) TypeError: unorderable types: tuple() < int() Why is that? Am I missing something very obvious? Kind regards, Johannes -- "Du bist einfach nur lächerlich! Mit solchen albernen und hohlen Sätzen kannst du mir nicht imprägnieren." -- Hobbycholeriker Jens Fittig aka Wolfgang Gerber in de.sci.electronics <4a6f44d0$0$12481$9b622...@news.freenet.de> -- http://mail.python.org/mailman/listinfo/python-list