[Numpy-discussion] order flag again

Charles R Harris charlesr.harris at gmail.com
Mon Mar 27 13:19:02 CST 2006


On 3/27/06, Fernando Perez <Fernando.Perez at colorado.edu> wrote:
>
> On 01:46 PM Tim Hochberg wrote:
>
> > As I've mentioned before, I'd like to sweep all of the operations that
> may
> > return a view or a copy into a few asXXXarray functions so that these
> > potentially problematic operations are localized and easily
> identifiable.
>
> +1 on the idea that:
>
> asXXXarray: functions which take their input and return always an array,
> but
> trying to avoid copies if at all possible.  This means that code calling
> such
> functions should treat their returned values strictly as /inputs/, never
> modifying them in place.  These functions are provided by numpy strictly
> for
> performance reasons.


How about Tim's example: b = asarray(a).reshape(newshape)

Or something like that.


I think the problem is mixing python list types with arrays. It is
convenient but we get into trouble.

What purpose does ascontiguous serve?

I like being able to tell to users that this kind of
> problem is solved by a unified familiy of functions in the API, with a
> clear
> naming convention.  There is a need for them, but they are also a bit
> dangerous, so they should be clearly labeled.  Painting them all in the
> same
> bright red helps indicate their 'sharp blade' nature.
>
> Cheers,
>
> f
>

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060327/8e43b1ba/attachment.html 


More information about the Numpy-discussion mailing list