<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Actually I use numpy for several years now, and I love it.</div>
<div>The reason that I think silent broadcasting of sums is bad<span style="line-height: 1.6em;"> </span></div>
<div><span style="line-height: 1.6em;">comes simply from the fact, that I had more </span><span style="line-height: 1.6em;">trouble with it, than it helped me.</span></div>
<div> </div>
<div>I won't stop using numpy because of that, but I think this behavior may backfire,</div>
<div>and thats the reason I started this discussion. Till now the only way out of the misery</div>
<div>is to make proper unit tests, and to be careful as hell with dimensions and shape checks.</div>
<div> </div>
<div>Providing optional warnings just would be an elegant way out of this.</div>
<div> </div>
<div>Cheers,</div>
<div>Stefan</div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Sonntag, 08. Februar 2015 um 22:56 Uhr<br/>
<b>Von:</b> "Matthew Brett" <matthew.brett@gmail.com><br/>
<b>An:</b> "Discussion of Numerical Python" <numpy-discussion@scipy.org><br/>
<b>Betreff:</b> Re: [Numpy-discussion] Silent Broadcasting considered harmful</div>
<div name="quoted-content">Hi,<br/>
<br/>
On Sun, Feb 8, 2015 at 1:39 PM, Simon Wood <sgwoodjr@gmail.com> wrote:<br/>
><br/>
><br/>
> On Sun, Feb 8, 2015 at 4:24 PM, Stefan Reiterer <domors@gmx.net> wrote:<br/>
>><br/>
>> I don't think this is a good comparison, especially since broadcasting is<br/>
>> a feature not a necessity ...<br/>
>> It's more like turning off/on driving assistance.<br/>
>><br/>
>> And as already mentioned: other matrix languages also allow it, but they<br/>
>> warn about it's usage.<br/>
>> This has indeed it's merits.<br/>
>> Gesendet: Sonntag, 08. Februar 2015 um 22:17 Uhr<br/>
>> Von: "Charles R Harris" <charlesr.harris@gmail.com><br/>
>> An: "Discussion of Numerical Python" <numpy-discussion@scipy.org><br/>
>> Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful<br/>
>><br/>
>><br/>
>> On Sun, Feb 8, 2015 at 2:14 PM, Stefan Reiterer <domors@gmx.net> wrote:<br/>
>>><br/>
>>> Yeah I'm aware of that, that's the reason why I suggested a warning level<br/>
>>> as an alternative.<br/>
>>> Setting no warnings as default would avoid breaking existing code.<br/>
>>> Gesendet: Sonntag, 08. Februar 2015 um 22:08 Uhr<br/>
>>> Von: "Eelco Hoogendoorn" <hoogendoorn.eelco@gmail.com><br/>
>>> An: "Discussion of Numerical Python" <numpy-discussion@scipy.org><br/>
>>> Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful<br/>
>>> > I personally use Octave and/or Numpy for several years now and never<br/>
>>> > ever needed braodcasting.<br/>
>>> But since it is still there there will be many users who need it, there<br/>
>>> will be some use for it.<br/>
>>><br/>
>>> Uhm, yeah, there is some use for it. Im all for explicit over implicit,<br/>
>>> but personally current broadcasting rules have never bothered me, certainly<br/>
>>> not to the extent of justifying massive backwards compatibility violations.<br/>
>>> Take It from someone who relies on broadcasting for every other line of<br/>
>>> code.<br/>
>>><br/>
>><br/>
>><br/>
>> It's how numpy works. It would be like getting into your car and being<br/>
>> warned that it has wheels.<br/>
>><br/>
>> Chuck<br/>
>> _______________________________________________ NumPy-Discussion mailing<br/>
>> list NumPy-Discussion@scipy.org<br/>
>> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br/>
>><br/>
><br/>
> I agree, I do not think this is a good comparison. All cars have wheels,<br/>
> there are no surprises there. This is more like a car that decides to do<br/>
> something completely different from everything that you learned about in<br/>
> driving school.<br/>
<br/>
> I find the broadcasting aspect of Numpy a turn off. If I go to add a 1x3<br/>
> vector to a 3x1 vector, I want the program to warn me or error out. I don't<br/>
> want it to do something under the covers that has no mathematical basis or<br/>
> definition. Also, Octave may provide a warning, but Matlab errors<br/>
> out..."Matrix dimensions must agree". Which they must, at least in my world.<br/>
<br/>
In a previous life, many of us were very serious users of Matlab,<br/>
myself included.<br/>
<br/>
Matlab / Octave have a model of the array as being a matrix, but numpy<br/>
does not have this model. There is a Matrix class that implements<br/>
this model, but usually experienced numpy users either never use this,<br/>
or stop using it.<br/>
<br/>
I can only say - subjectively I know - that I did not personally<br/>
suffer from this when I switched to numpy from Matlab, partly because<br/>
I was fully aware that I was going to have to change the way I thought<br/>
about arrays, for various reasons. After a short while getting used<br/>
to it, broadcasting seemed like a huge win. I guess the fact that<br/>
other languages have adopted it means that others have had the same<br/>
experience.<br/>
<br/>
So, numpy is not a straight replacement of Matlab, in terms of design.<br/>
<br/>
To pursue the analogy, you have learned to drive an automatic car.<br/>
Numpy is a stick-shift car. There are good reasons to prefer a<br/>
stick-shift, but it does mean that someone trained on an automatic is<br/>
bound to feel that a stick-shift is uncomfortable for a while.<br/>
<br/>
Best,<br/>
<br/>
Matthew<br/>
_______________________________________________<br/>
NumPy-Discussion mailing list<br/>
NumPy-Discussion@scipy.org<br/>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a></div>
</div>
</div></div></body></html>