[Numpy-discussion] copy on demand

Scott Ransom ransom at physics.mcgill.ca
Sat Jun 15 06:13:05 EDT 2002

On Sat, Jun 15, 2002 at 10:53:17AM +0200, Konrad Hinsen wrote:

> > floating around just seems like an invitation for confusion. I'm
> > very much in favor of picking one or the other behaviors and then
> > making some means of explicitly getting the other behavior.
> Then the only solution I see is the current one: default behaviour is
> view, and when you want a copy yoy copy explicitly. The inverse is not
> possible, once you made a copy you can't make it behave like a view
> anymore.

I don't think it is necessary to create the other object _from_
the default one.  You could have copy behavior be the default,
and if you want a view of some array you simply request one
explicitly with .view, .sub, or whatever.

Since creating a view is "cheap" compared to creating a copy,
there is nothing sacrificed doing things in this manner.


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 mailing list