I've used as_strided before to create an "endless" output array when I didn't care about the result of an operation, just the side effect. See eg here <https://github.com/scikit-image/scikit-image/blob/master/skimage/future/graph/rag.py#L146>. So I would certainly like option to remain to get a writeable array. In general, I'm sceptical about whether the benefits outweigh the costs.
On Sun, Jan 24, 2016 at 9:20 AM, Nathaniel Smith <n...@pobox.com> wrote: > On Sat, Jan 23, 2016 at 1:25 PM, Sebastian Berg > <sebast...@sipsolutions.net> wrote: > > > > Hi all, > > > > I have just opened a PR, to make as_strided writeonly (as default). The > > I think you meant readonly :-) > > > reasoning for this change is that an `as_strided` array often have self > > overlapping memory. However, writing to an array where multiple > > elements have the identical memory address can be confusing, and the > > results are typically unpredictable. > > > > Considering the danger, the proposal is to add a `readonly=True`. A > > poweruser (who that function is designed for anyway), could thus still > > get a writeable array. > > > > For the moment, writing to the result would raise a FutureWarning with > > `readonly="warn"`. > > This should just be a deprecation warning, right? (Because switching > an array from writeable->readonly might cause previously correct code > to error out, but not to silently start returning different results.) > > > Do you agree with this, or would it be a major inconvenience? > > AFAIK the only use cases for as_strided involve self-overlap (for > non-self-overlap you can generally use reshape / indexing / etc. and > it's much simpler). So +1 from me. > > -n > > -- > Nathaniel J. Smith -- https://vorpus.org > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion