On Mar 13, 3:48 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > So maybe this is not as bad as I feared. What are some use > > cases that will clearly be harder (i.e., at least require > > a slightly elaborate wrapper) after this change?
Sorting tuples, where the second item in the tuple should have the opposite ordering to the first is going to be a bit of a pain. Or even worse, where the ordering of the second item depends on the value of the first item in the tuple. For example, suppose that (for whatever contrived reason) you're representing integers in (sign, magnitude) format by tuples (s, i), where s = 0 or 1 (0 for positive, 1 for negative) and i is a string representing the absolute value of the integer. So (0, '3') represents 3 (1, '14') represents 14 and you want to sort according to numeric value. One can certainly come up with a key that works, but it's not quite as straightforward as writing a custom __cmp__. This isn't a totally contrived example: the internal Decimal format isn't so different from this. Mark -- http://mail.python.org/mailman/listinfo/python-list