[Numpy-discussion] Shapes and sizes
Sasha
ndarray at mac.com
Fri Feb 24 10:54:03 EST 2006
On 2/24/06, Sasha <ndarray at mac.com> wrote:
> Try
> >>> empty(map(outsize, arra.shape))
Oops. I did not realize that you want to apply outsize to the last
dimension only. For ndim>1, you can do
>>> empty(arra.shape[:-1]+(outsize(arra.shape[-1]),))
That will not work work for scalars though, but you might want to
rethink whether your function makes sense for scalars. Remember, 1 is
not the same as [1] in python, you maybe trying to copy MATLAP design
too literally.
More information about the NumPy-Discussion
mailing list