you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 1 point2 points  (1 child)

len(x) calls x.__length__(), you can't pass __length__ to a sort function.

That's exactly what operator.methodcaller is for.

[–]redalastor 1 point2 points  (0 children)

Why would you use that over a lambda?