[Numpy-discussion] Ravel and inplace modification
Gael Varoquaux
gael.varoquaux at normalesup.org
Thu Mar 20 08:04:25 EDT 2008
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?
Cheers,
Gaël
More information about the NumPy-Discussion
mailing list