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

Pierre Haessig pierre.haessig at crans.org
Thu Dec 11 09:31:21 EST 2014

Le 11/12/2014 01:00, Nathaniel Smith a écrit :
> Seems like a useful addition to me -- I've definitely wanted this in
> the past. I agree with Stephan that reshape() might not be the best
> place, though; I wouldn't think to look for it there.
> Two API ideas, which are not mutually exclusive:
> [...]
> 2) Add a broadcast_to(arr, shape) function, which broadcasts the array
> to exactly the shape given, or else errors out if this is not
> possible.
That's also possible. Then there could be a point in `reshape` docstring.

Could this function be named `broadcast` instead of `broadcast_to` ?
(in coherence with `reshape`)


More information about the NumPy-Discussion mailing list