How do I sort a list of strings by key=len first then by key=str? I\'ve tried the following but it\'s not giving me the desired sort:
key=len
key=str
Another form that works without a lambda:
>>> [t[1] for t in sorted((len(s),s) for s in ls)] ['bar', 'foo', 'barbar', 'foobar']