Obsolesence of <>

Jose' Sebrosa sebrosa at artenumerica.com
Fri Jun 1 05:10:27 CEST 2001


s713221 at student.gu.edu.au wrote:
> 
> > "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?

As far as I remember from my first subject on Calculus or so, the set of
Complex Numbers has *not* the property of being ordered. So, from the
mathematical point of view, it makes no sense to ask questions like "which of
two given complex numbers is smaller".

Sebrosa



More information about the Python-list mailing list