On Wed, Nov 14, 2018 at 2:35 PM Sebastian Berg <sebast...@sipsolutions.net> wrote:
> On Wed, 2018-11-14 at 14:32 -0500, Marten van Kerkwijk wrote: > > Code being better than words: see > > https://github.com/numpy/numpy/pull/12388 for an implementation. The > > change in the code proper is very small, though it is worrying that > > it causes two rather unrelated tests too fail (even if arguably both > > tests were wrong). > > > > Note that this does not give flexibility to put the axis where one > > wants; as written, the code made putting it at the start the obvious > > solution, as it avoids doing anything with the shapes of start and > > stop. > > Hehe, my first gut feeling was the last axis to be the obvious one ;). > This has been discussed before (but what hasn't) I believe, probably > some old issue or even PR somewhere. > I am mildly in favor, just because there is probably not much reason > against an easy vectorization. Doesn't need to be advertised much in > the docs anyway. > Although it might be good to settle the "obvious" part in case I am not > alone in first thinking of -1 being the obvious default. I would > probably skip the axis argument for now, unless someone actually has a > use case. Indeed -- I think the best argument for adding an "axis" argument is that it allows people to be explicit about where the axis ends up, e.g., both np.linspace(start, stop, num=5, axis=0) and np.linspace(start, stop, num=5, axis=-1) make their intent quite clear. To me, axis=0 feels like the right default, matching np.concatenate and np.stack. But NumPy already has split conventions for this sort of thing (e.g., gufuncs add axes at the end), so I like the explicit option.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion