Re: [Numpy-discussion] object scalars

2011-07-12 Thread Johann Hibschman
Olivier Delalleau writes: > 2011/7/12 Johann Hibschman > > Is there any way to wrap a sequence (in particular a python list) as a > numpy object scalar, without it being promoted to an object array? > I found a workaround but it's a bit ugly: > def some_call(x): >   rval = numpy.array(N

Re: [Numpy-discussion] object scalars

2011-07-12 Thread Olivier Delalleau
I found a workaround but it's a bit ugly: def some_call(x): rval = numpy.array(None, dtype='object') rval.fill(x) return rval -=- Olivier 2011/7/12 Johann Hibschman > Is there any way to wrap a sequence (in particular a python list) as a > numpy object scalar, without it being promoted to

[Numpy-discussion] object scalars

2011-07-12 Thread Johann Hibschman
Is there any way to wrap a sequence (in particular a python list) as a numpy object scalar, without it being promoted to an object array? In particular, np.object_([1, 2]).shape == (2,) np.array([1,2], dtype='O').shape == (2,) while I want some_call([1,2]).shape = () Thanks, Johann