sorting a dictionary
Alex Martelli
aleax at aleax.it
Fri Feb 7 02:53:48 EST 2003
Mel Wilson wrote:
...
> What would that look like? (Python 2.1.3 dies
> comparing a complex against a string.)
>
>
> def square_peg_vs_round_hole (a, b):
This implementation raises an exception when you try
to compare (e.g.) lists whose first items are a
complex and any number respectively (because it falls
back to cmp for this case and cmp cannot know it
needs to call square_etc recursively for lexical
comparisons of sequences). Reimplementing all of
cmp is quite a bother...
Alex
More information about the Python-list
mailing list