On Fri, May 9, 2008 at 11:43 AM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Fri, May 9, 2008 at 1:41 PM, Keith Goodman <[EMAIL PROTECTED]> wrote:
>> That looks good. But at the end of the function I'll have to convert
>> back to a 1d array if the input is 1d
>>
>> np.whence_you_came_from(x)
>>
>> I guess there is no way to not test for the shape.
>
> Well, in this case, since you are modifying the data in-place, just
> return the original array.
>
> x2 = atleast_2d(x)
> x2[i,j] = something
> return x

Nice! That was the beauty of atleast_2d---it returns a view. I see now
that views are not just for speed.
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to