[Numpy-discussion] copy on demand
ransom at physics.mcgill.ca
Fri Jun 14 16:27:01 CDT 2002
I was going to write an almost identical email, but Chris saved me the
trouble. These are my feelings as well.
On June 14, 2002 07:01 pm, Chris Barker wrote:
> Konrad Hinsen wrote:
> > Not necessarily. We could decide that
> > array.view
> > is a view of the full array object, and that slicing views returns
> > subviews.
> Please don't!! Having two types of arrays around in a single program
> that have the same behaviour except when they are sliced is begging for
> confusion and hard to find bugs.
> I agree with Perry, that I occasionaly use the view behaviour of
> slicing, and it is very usefull when I do, but most of the time I would
> be happier with copy symantics. All I want is a way to get at a view of
> part of an array, I don't want two different kinds of array around with
> different slicing behaviour.
> > My main objection to changing the slicing behaviour is, like with some
> > other proposed changes, compatibility.
> The switch from Numeric to Numarray is a substantial change. I think we
> should view it like the mythical Py3k: an oportunity to make
> incompatible changes that will really make it better.
> By the way, as an old MATLAB user, I have to say that being able to get
> views from a slice is one behaviour of NumPy that I really appreciate,
> even though I only need it occasionally. MATLAB, howver is a whole
> different ball of wax in a lot of ways. There has been a lot of
> discussion about the copy on demand idea in MATLAB, but that is
> primarily useful because MATLAB has call by value function semantics, so
> without copy on demand, you would be making copies of large arrays
> passed to functions that weren't even going to change them. I don't
> think MATLAB impliments copy on demand for slices anyway, but I could be
> wrong there.
> Oh, and no function (ie ravel() ) should return a view in some cases,
> and a copy in others, that is just asking for bugs!
Scott M. Ransom Address: McGill Univ. Physics Dept.
Phone: (514) 398-6492 3600 University St., Rm 338
email: ransom at physics.mcgill.ca Montreal, QC Canada H3A 2T8
GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989
More information about the Numpy-discussion