[Numpy-discussion] Probable bug

Joachim Saul list at jsaul.de
Tue Jan 17 04:49:01 CST 2006


Hello all,

I have observed a weird behaviour with 24.2, which actually can
break existing code:

>>> import Numeric
>>> Numeric.__version__
'23.8'
>>> x=Numeric.zeros(5)
>>> type(x[0])
<type 'int'>
>>> x=Numeric.zeros(5,'f')
>>> type(x[0])
<type 'float'>
>>>

This is what I would expect. However, using 24.2:

>>> import Numeric
>>> Numeric.__version__
'24.2'
>>> x=Numeric.zeros(5)
>>> type(x[0])
<type 'int'>
>>> x=Numeric.zeros(5, 'f')
>>> type(x[0])
<type 'array'>
>>> print type(1*x[0])
<type 'float'>

Strange, isn't it? Is there any rationale behind this inconsistent
behaviour or is it just a bug?

Cheers,
Joachim





More information about the Numpy-discussion mailing list