Obsolesence of <>

s713221 at student.gu.edu.au s713221 at student.gu.edu.au
Fri Jun 1 07:11:59 EDT 2001


> "Alex Martelli" <aleaxit at yahoo.com> wrote:
> | Sorry, you're behind the times:
> |
> | Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32
> | Type "copyright", "credits" or "license" for more information.
> | Alternative ReadLine 1.1 -- Copyright 2001, Chris Gonnerman
> | >>> x=2+3j
> | >>> y=5+8j
> | >>> x<y
> | Traceback (most recent call last):
> |   File "<stdin>", line 1, in ?
> | TypeError: cannot compare complex numbers using <, <=, >, >=

I haven't checked the PEP's (I'm down to 4 h on my uni network account,
so I'm being conservative), but I'd hasard a guess this is because
there's several ways to compare complex numbers. 5 + 8j is obviously
larger than 2 + 3j because both the real and imaginary values are
larger, but what about x = 2 + 3j and y = 5 + 1j where one has a larger
real value and another has a larger imaginary value?
Do you take y to be larger than x because |y| is larger than |x|? What
if you've got two values that have the same |z| but different theta
angles? Eg. x = 2 + 3j and y = 3 + 2j?

My two cents worth,
Joal Heagney/AncientHart



More information about the Python-list mailing list