[MATRIX-SIG] array objects and if?

Christine Pao pao@Goldilocks.LCS.MIT.EDU
Tue, 23 Sep 1997 16:52:20 -0400


I've just run into a problem using if:

>>> if Numeric.array([]):
...     print 1
... else:
...     print 0
... 
0

This is what I would expect, but

>>> if Numeric.array([0]):
...     print 1
... else:
...     print 0
... 
0

and

>>> if Numeric.zeros((3,3)):
...     print 1 
... else:
...     print 0
... 
0

isn't the way other sequences behave.

I don't know if this has come up before.
Is this what is supposed to happen?

Thanks,
Christine Pao

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

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