[Numpy-discussion] logical_and operator, &&, is missing? (original) (raw)
Robert Kern robert.kern at gmail.com
Sat Jun 24 16:20:43 EDT 2006
- Previous message (by thread): [Numpy-discussion] logical_and operator, &&, is missing?
- Next message (by thread): [Numpy-discussion] logical_and operator, &&, is missing?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Eric Firing wrote:
It seems that the logical operators || and &&, corresponding to logicalor and logicaland are missing; one can do
z = logicaland(x,y) but not z = x && y Is there an inherent reason, or is this a bug?
Python does not have a && operator. It has an "and" keyword, but that cannot be overridden. If you know x and y to be boolean arrays, & and | work fine.
z = (x == y)
works, and a comment in umathmodule.c.src suggests that && and || should also: /**begin repeat #kind=greater, greaterequal, less, lessequal, equal, notequal, logicaland, logicalor, bitwiseand, bitwiseor, bitwisexor# #OP=>, >=, <, <=, ==, !=, &&, ||, &, |, ^# **/
Those operators are the C versions that will be put in the appropriate places in the generated code. That is not a comment for documentation.
-- Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
- Previous message (by thread): [Numpy-discussion] logical_and operator, &&, is missing?
- Next message (by thread): [Numpy-discussion] logical_and operator, &&, is missing?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]