[Numpy-discussion] Slight inconsistency between 'f' shape () array and python scalar
Rob W. W. Hooft
rob at hooft.net
Tue Jul 4 03:53:10 EDT 2000
Hm. I found a bug in one of my programs that was due to the difference in
behavior between a 'f' shape () array and a true python scalar:
import Numeric
a=Numeric.zeros((50,50),'f')
b=[]
for i in range(50):
d=a[i,i]
b.append(d)
nb=Numeric.array(b)
print nb.shape # Expect (50,) but get (50,1)
BTW: Why does "a=Numeric.zeros((50,),'f'); d=a[i]" return a python scalar, and
the above script a shape () array?
Rob
--
===== rob at hooft.net http://www.hooft.net/people/rob/ =====
===== R&D, Nonius BV, Delft http://www.nonius.nl/ =====
===== PGPid 0xFA19277D ========================== Use Linux! =========
More information about the NumPy-Discussion
mailing list