[Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?

Stephan Hoyer shoyer at gmail.com
Fri Dec 12 14:46:36 EST 2014


On Fri, Dec 12, 2014 at 6:25 AM, Jaime Fernández del Río <
jaime.frio at gmail.com> wrote:

> it seems that all the functionality that has been discussed are one-liners
> using nditer: do we need new functions, or better documentation?
>

I think there is utility to adding a new function or two (my inclination is
to expose broadcast_to in the public API, but leave common_shape in
strick_tricks). NumPy provides all the cools to write these in a few lines,
but you need to know some very deep details of the NumPy API (nditer and
strides).

I don't think more documentation would make this obvious -- certainly
nditer does not need a longer docstring! The best sort of documentation
would be more examples. If this is a recipe that many NumPy users would
use, including it in stride_tricks would also serve such an educational
purpose (reading stride_tricks is how I figured out how strides work).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141212/b738e143/attachment.html>


More information about the NumPy-Discussion mailing list