[SciPy-dev] 'O' type arrays and containers as values...

Fernando Perez Fernando.Perez at colorado.edu
Fri Nov 4 13:01:45 CST 2005


Hi all,

If I understand things correctly, the following should work fine:

In [3]: import scipy

In [4]: scipy.__core_version__
Out[4]: '0.4.3.1433'

In [5]: a=scipy.empty((2,2),'O')

In [6]: a[0,0] = (1,2,3)
---------------------------------------------------------------------------
exceptions.ValueError                                Traceback (most recent 
call last)

/home/phillips/student/fperez/<console>

ValueError: number of elements in destination must be integer multiple of 
number of elements in source


Why can't I assign a container (it fails for tuples, lists and arrays) as the 
_value_ of an 'O' array?  Note that strings work fine:

In [7]: a[0,0] = '(1,2,3)'


Am I missing something here?  It seems to me that 'O' type arrays should be 
able to hold as values arbitrary python objects, no?

Cheers,

f




More information about the Scipy-dev mailing list