[Numpy-discussion] (a and b) != (b and a) ?

Chris Barker Chris.Barker at noaa.gov
Wed Jun 12 16:21:04 CDT 2002


Tim Hochberg wrote:
> > I imagine there is a compelling reason that "and" and "or" have not been
> > overridden like the comparison operators, but it sure would be nice!
> 
> Because it's not possible?

Well, yes, but it wasn't possible with <,>,== and friends untill rich
comparisons were added in Python 2.1. So I am still wondering why the
same extension wasn't made to "and" and "or". In fact, given that Guido
is adding a bool type, this may be a time to re-visit the question,
unless there really is a compelling reason not to, which is quite
likely. 

> In practice I haven't found this to be much of a problem. Nearly every time
> I need to and two arrays together, "&" works just as well as logical_and.

This has always worked for me, as well, so maybe the answer is that
there is no compelling reason to make a change.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer
                                    		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the Numpy-discussion mailing list