[SciPy-user] variable (undetermined at initialization) dimension of an array ?

Pearu Peterson pearu at scipy.org
Fri Aug 22 05:45:06 EDT 2003


On Fri, 22 Aug 2003, Nils Wagner wrote:

> Is it possible to create an array, where the dimension is undefined at
> the beginning ?

It depends on what are the applications of such an array.

For arrays that dimensions ought to be truely undefined you
can implement your own array class.

On the other hand, have you looked at the resize method
of a Numeric array:

>>> from Numeric import *
>>> a=array([])
>>> a.shape
(0,)
>>> a.resize((4,))
>>> a.shape
(4,)
>>> a.resize((2,))
>>> a.shape
(2,)

Note that you cannot use `a` slices before calling
the resize method.

Pearu




More information about the SciPy-User mailing list