[SciPy-User] scalars vs array of length 1

David Warde-Farley dwf@cs.toronto....
Thu Jul 8 12:23:15 CDT 2010


On 2010-07-08, at 12:44 PM, Victor Eijkhout wrote:

> I want to write a function that can accept both a scalar and a vector, when called on a vector it should return a vector of scalar application results. However, scalars seem to be treated differently from length-1 lists.

...

> 
> How do I get that shape to be the same in both cases?

x = atleast_1d(x)

David


More information about the SciPy-User mailing list