7 Answers
7

In the general case, you'll want to write your key-extraction function for sorting purposes; only in special (though important) cases it happens that you can just reuse an existing callable to extract the keys for you, or just conjoin a couple of existing ones (in a "quick and dirty" way using lambda, since there's no built-in way to do function composition).

If you often need to perform these two kinds of operations for key extraction (get an item and call a method on that item), I suggest:

so listofdicts.sort(key=combiner('name', 'lower')) will work in your case.

Note that while excessive generalization has costs, tasteful and moderate generalization (leaving the item key, method name, and method arguments if any, as runtime-determined, in this case) generally has benefits -- one general function, not more complex than a dozen specific and specialized ones (with the extractor, method to call, or both, hardwired in their code), will be easier to maintain (and, of course, much easier to reuse!-).

You probably should go with a lambda for the sake of readability. But as an interesting study into higher order functions, here's the extended version of q-combinator in Python (also known as the queer bird combinator). This allows you to create a new function by composing two functions

This of course uses that the locale sort is the User interface "natural" sort that you wish to emulate with .lower().

I'm amazed that python's locale module is unknown and unused, it for sure is an important component in the application I write (translated to multiple languages, but the locale module is important for even getting one module right. Case in point: in swedish 'V' and 'W' sort alike, so you have to collate them. locale does all that for you.).
In the POSIX locale (not default), this will revert to sorting "a" after "Z".