Obsolesence of <> (fwd)

Jose' Sebrosa sebrosa at artenumerica.com
Fri Jun 1 19:26:39 EDT 2001


Lulu of the Lotus-Eaters wrote:
> 
> Jose' Sebrosa <sebrosa at artenumerica.com> wrote:
> |The problem with complexes is to arrange them in a unidimentional structure. As
> |we can map R to C (and vice-versa), it is possible:
> |[...complex mapping C --> R...]
> |Thats the only way I can figure to invent a comparison between two complexes,
> |and it seems preety absurd to me...
> 
> Here's an obvious way to well-order two complex numbers:
> 
>     def lexigraphic_order(c1,c2):
>         if c1.real < c2.real: return -1
>         elif c1.real > c2.real: return 1
>         else: return cmp(c1.imag,c2.imag)
> 
> For most purposes, the lexigraphic order has little mathematical use.
> Here's another obvious one that has a bit of mathematical meaning:
> 
>     def magnitude_order(c1,c2):
>         if c1==c2: return 0
>         elif abs(c1)==abs(c2): return cmp(c1.real,c2.real)
>         else: return cmp(abs(c1),abs(c2))
> 
> I-could-probably-even-order-unicode-strings-ly yours, Lulu...

Sure, you are all right and I was overcomplicating it all. I like most the
map-complexes-to-tuples-then-compare-tuples approach, but these could also do.

Sebrosa



More information about the Python-list mailing list