[Numpy-discussion] complex comparisons

Perry Greenfield perry at stsci.edu
Mon Mar 20 09:03:11 CST 2006

Let me throw my 2 cents in as well. As Paul mentions this has been 
discussed before. It seems nonsensical to allow these comparisons since 
there is bound to be some confusion about their meaning no matter what 
is chosen. And if someone would like their code to be generic with 
regard to complex numbers and regular floats, then they should use 
.real, .imag, and abs() explicitly to be precise about what they are 
comparing. All these will work with both kinds of types.


On Mar 20, 2006, at 11:03 AM, Paul Dubois wrote:

> Plus ca change, plus c'est la meme chose. How many times have we 
> discussed this? I'm with Tim. In fact of course using even the 
> equality operators is often a mistake, but at least there you can 
> think of a use case.
> On 20 Mar 2006 07:58:54 -0800, Tim Hochberg <tim.hochberg at cox.net> 
> wrote:
>> I just noticed that complex arrays can be compared using [<, <=, > and
>>  >=]. Do we really want  this? I'd prefer to follow numarray's lead 
>> here
>> and only support [==, !=] on complex arrays.

More information about the Numpy-discussion mailing list