This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients Sergey.Kirpichev, benjamin.peterson, mark.dickinson, matrixise, paul.moore, r.david.murray, rhettinger, tim.peters
Date 2015-04-29.18:51:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On 29 April 2015 at 19:42, Sergey B Kirpichev <> wrote:
>> It's a common computer science technique
> Could you provide any language that avoid this optimization?
> Here is Perl 5:
> (third example)

But that's a sort without a key. In Perl you do a key sort via:

@sorted = map  { $_->[0] }
          sort { $a->[1] <=> $b->[1] } # use numeric comparison
          map  { [$_, length($_)] }    # calculate the length of the string

(From That
computes the keys first, and would compute the key for a list of
length 1, just like Python does. It's just that Python bundles that
whole construct into the "key=" argument.

But it's your choice - if this is a big enough deal to put you off
Python, I guess no-one will be able to stop you. The fact of the
matter is that what Python does is documented behaviour, and the
benefit (small) isn't worth the cost of making a change (which would
only be in Python 3.5 and later anyway, as it's a backward
incompatible change, not a bug fix).
Date User Action Args
2015-04-29 18:51:21paul.mooresetrecipients: + paul.moore, tim.peters, rhettinger, mark.dickinson, benjamin.peterson, r.david.murray, matrixise, Sergey.Kirpichev
2015-04-29 18:51:21paul.moorelinkissue24075 messages
2015-04-29 18:51:21paul.moorecreate