[PYTHON MATRIX-SIG] logical_or and logical_and and # of argumen ts

Perry A. Stoll pas@xis.xerox.com
Wed, 19 Mar 1997 13:36:59 PST


Isn't logical_or a ofunc_object? If so, I thought the format was:
ofunc(in1,in2,out=None), meaning you were storing the result of
the operation in the temporary array greater(x,3). Then it's gone.
Try this:

x = arange(5)
y = arange(5)

logical_or(greater(x, 1),
           greater(x, 2),
           y)
print y

Get it?
     
-Perry


On 19 Mar, David Ascher wrote:
> 
> Uh...
> 
> If x = arange(5), 
> 
> logical_or(greater(x, 1),
>            greater(x, 2)
>           )
> 
> does what I think it should.  So does:
> 
> logical_or(greater(x, 1),
>            greater(x, 2),
> 	   greater(x, 3)
>           )
> 
> [as in (x > 1 || x > 2 || x > 3) ]
> 
> but:
>  
> logical_or(greater(x, 1),
>            greater(x, 2),
> 	   greater(x, 3),
> 	   greater(x, 4)
>           )
>  
> complains about invalid number of arguments. 
> 
> Either logical_or can deal with a large number of arguments or it can't --
> if it can't, what does the 3-argument version mean?




_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________