[Numpy-discussion] Ravel and inplace modification
Charles R Harris
Thu Mar 20 10:12:17 CDT 2008
On Thu, Mar 20, 2008 at 9:11 AM, Charles R Harris <firstname.lastname@example.org>
> On Thu, Mar 20, 2008 at 6:04 AM, Gael Varoquaux <
> email@example.com> wrote:
> > At the nipy sprint in Paris, we have been having a discussion about
> > methods modifying inplace and returning a view, or returning a copy.
> > The main issue is with ravel that tries to keep a view, but that
> > obviously has to do a copy sometimes. (Is ravel the only place where
> > this
> > behavior can happen ?). We came up with the following scenario:
> > Mrs Jane is an experienced Python developper, working with less
> > experienced developpers. She has developped a set of functions to
> > process
> > data that assume they can use the ravel method returning a view. One day
> > another programmes feeds it new kind of data. The functions work, but
> > return something wrong.
> > We (Stefan van der Walt, Matthew Brett and I) are suggesting that it
> > would be a good idea to add a keyword to the ravel method so that it
> > raises an exception if it cannot return a view. Stefan is proposing to
> > implement it.
> > What do people think about this? Should Stefan go ahead?
> Ravel is not writeable, so it can't be used on the left side of
> assignments where the view/copy semantics could be a problem.
Argghhh, how did that line sneak in there? Ignore it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion