Johannes Bauer writes:
> def myorder(x):
> if type(x[0]) == int:
> return x[0]
> else:
> return x[0][0]
I used to write code like that pretty regularly, but over time I found
that it's better to stay consistent and use the same container format
(in this case, tuples) f
MRAB schrieb:
> Johannes Bauer wrote:
>> 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 da
Johannes Bauer wrote:
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
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)
stil