<div dir="ltr">On Thu, Dec 11, 2014 at 4:17 PM, Sebastian Berg <<a href="mailto:sebastian@sipsolutions.net">sebastian@sipsolutions.net</a>> wrote:<br>><br>> On Do, 2014-12-11 at 16:56 +0100, Pierre Haessig wrote:<br>> > Le 11/12/2014 16:52, Robert Kern a écrit :<br>> > ><br>> > > And we already have a numpy.broadcast() function.<br>> > ><br>> > > <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>> > True, I once read the docstring of this function. but never used it though.<br>><br>> I am not sure it is really the right thing for most things since it<br>> returns an old style iterator.<div><br></div><div>Indeed. That's why I wrote broadcast_arrays().</div><div><br></div><div>> On the other hand arrays with 0-strides<br>> need a bit more care (if we add this top level, one might have copy=True<br>> as a default or so?).<br>> Also because of that it is currently limited to NPY_MAXARGS (32).<br>> Personally, I would like to see this type of functionality implemented<br>> in C, and may be willing to help with it. This kind of code exists in<br>> enough places in numpy so it can be stolen pretty readily. One option<br>> would also be to have something like:<br>><br>> np.common_shape(*arrays)<br>> np.broadcast_to(array, shape)<br>> # (though I would like many arrays too)<br>><br>> and then broadcast_ar rays could be implemented in terms of these two.<br><br>Why? What benefit does broadcast_arrays() get from being reimplemented in C?<br><br>--<br>Robert Kern</div></div>