Keith Goodman wrote:

> But are there any unintended consequences of changing from array to 
> asanyarray?

Not by itself, no. That entails that the implementations cannot rely on any
particular behavior of the arrays. The correct(ish) approach looks something
like the following, I believe:


def foo(input):
    input_arr = asanyarray(input)
    wrapper = input_arr.__array_wrap__
    input_arr = asarray(input_arr)

    # Do stuff on input_arr to get output_arr (an ndarray).

    return wrapper(output_arr)


-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to