Obsolesence of <> (fwd)

Lulu of the Lotus-Eaters mertz at gnosis.cx
Fri Jun 1 16:36:13 EDT 2001


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...





More information about the Python-list mailing list