How to sort a list of strings on a substring
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Tue Oct 6 00:03:57 EDT 2009
On Mon, 05 Oct 2009 20:33:51 -0700, n00m wrote:
>> No, that's incorrect. Try it with this data and you will see it fails:
>
> Of course, you are right, but I think the topic-starter is smart enough
> to understand that I suggested only a hint, a sketch, a sample of how to
> use "key=" with "lambda", not a ready-to-apply solution.
Oh please. That's a ridiculous excuse. Your post started with "Here you
are" -- the implication is that you thought it *was* a solution, not a
hint. A hint would be something like "Write a key function, perhaps using
lambda, and pass it to the sort() method using the key parameter."
There's no shame at writing buggy code. There's not a person here who has
never made a silly mistake, and most of us have done so in public too.
Some real clangers too. What matters is how folks respond to having the
their mistakes pointed out, and whether they learn from it.
--
Steven
More information about the Python-list
mailing list