[Numpy-discussion] Ravel and inplace modification

Nadav Horesh nadavh at visionsense.com
Sat Mar 22 03:28:43 EDT 2008


+1

-----הודעה מקורית-----
מאת: numpy-discussion-bounces at scipy.org בשם Charles R Harris
נשלח: ה 20-מרץ-08 17:12
אל: Discussion of Numerical Python
נושא: Re: [Numpy-discussion] Ravel and inplace modification
 
On Thu, Mar 20, 2008 at 9:11 AM, Charles R Harris <charlesr.harris at gmail.com>
wrote:

>
>
> On Thu, Mar 20, 2008 at 6:04 AM, Gael Varoquaux <
> gael.varoquaux at normalesup.org> 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.

Chuck

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3762 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080322/e58d7581/attachment.bin>


More information about the NumPy-Discussion mailing list