J
Johannes Bauer
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
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