<div dir="ltr">On Thu, Dec 11, 2014 at 2:47 PM, Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br>><br>> On 11 Dec 2014 14:31, "Pierre Haessig" <<a href="mailto:pierre.haessig@crans.org">pierre.haessig@crans.org</a>> wrote:<br>> ><br>> ><br>> > Le 11/12/2014 01:00, Nathaniel Smith a écrit :<br>> > > Seems like a useful addition to me -- I've definitely wanted this in<br>> > > the past. I agree with Stephan that reshape() might not be the best<br>> > > place, though; I wouldn't think to look for it there.<br>> > ><br>> > > Two API ideas, which are not mutually exclusive:<br>> > ><br>> > > [...]<br>> > ><br>> > > 2) Add a broadcast_to(arr, shape) function, which broadcasts the array<br>> > > to exactly the shape given, or else errors out if this is not<br>> > > possible.<br>> > That's also possible. Then there could be a point in `reshape` docstring.<br>> ><br>> > Could this function be named `broadcast` instead of `broadcast_to` ?<br>> > (in coherence with `reshape`)<br>><br>> It could, but then there wouldn't be much to distinguish it from broadcast_arrays. Broadcasting is generally a symmetric operation - see broadcast_arrays or arr1 + arr2. So the 'to' is there to give a clue that this function is not symmetric, and rather has a specific goal in mind.<br><br>And we already have a numpy.broadcast() function.<div><br></div><div><a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.broadcast.html">http://docs.scipy.org/doc/numpy/reference/generated/numpy.broadcast.html</a><br><br>--<br>Robert Kern</div></div>