One line sort

ast ast at invalid
Mon Nov 15 08:10:39 EST 2021


A curiosity:

q = lambda x: x and q([i for i in x[1:] if i < x[0]]) + [x[0]] + q([i 
for i in x[1:] if i >= x[0]])

 >>> q([7, 5, 9, 0])
[0, 5, 7, 9]


More information about the Python-list mailing list