Steven D'Aprano ha scritto: > It was easy. I never once asked myself whether some complex number was > greater or less than another, I just asked "which one comes first in a > lexicographic sort?" > > The two questions are NOT the same, and it is an ugliness in an otherwise > beautiful language that Python treats them as the same. > > Mathematically, 1 == 1.0 == 1+0j but in the dictionary "1" should sort > before "1.0" which sorts before "1.0+0.0j".
Because, of course, when I sort numbers the first thing I think of is looking at the ascii table... Here I was, thinking maths was useful. Sorting numbers "lexicographically" might make sense to you, but it's totally unintuitive to me. For example, why or how would I guess that "3-3j" is bigger (or smaller) than "3+3j"? You'll still want to sort complex numbers lexicographically. It'll still have no meaning whatsoever, so you might as well leave the list unsorted. You might think you sorted something. 100? 200? years of maths say you didn't. -- Adriano Varoli Piazza The Inside Out: http://moranar.com.ar MSN: [EMAIL PROTECTED] ICQ: 4410132 -- http://mail.python.org/mailman/listinfo/python-list