Guido rethinking removal of cmp from sort method

Chris Angelico rosuav at gmail.com
Tue Mar 29 15:08:22 EDT 2011


On Wed, Mar 30, 2011 at 5:57 AM, MRAB <python at mrabarnett.plus.com> wrote:
> You would have to do more than that.
>
> For example, "" < "A", but if you "negate" both strings you get "" <
> "\xBE", not "" > "\xBE".

Strings effectively have an implicit character at the end that's less
than any other character. Easy fix: Append a character that's greater
than any other. So "" < "A" becomes "\xFF" > "\xBE\xFF".

Still not going to be particularly efficient.

Chris Angelico



More information about the Python-list mailing list