In:
case-insensitive list sorting, without lowercasing the result?
I've seen two solutions:
(Let;s assume input is list of utf-8 strings, e.g. ['z1', 'A1', 'a0', 'bC']
)
- Without lambda:
L.sort(key = str.lower);
- With lambda:
L.sort(key = lambda s: s.lower());
What are differences? Which is better or more "pythonic"?
(As I tagged question is about python-3.x
. All comments related to behaviour specific to python 2 are welcome, but please make note)