<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Feb 8, 2015 at 2:17 PM, Stefan Reiterer <span dir="ltr"><<a href="mailto:domors@gmx.net" target="_blank">domors@gmx.net</a>></span> wrote:<br><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12.0px"><div>Till now the only way out of the misery<br></div>
<div>is to make proper unit tests,</div></div></div></blockquote><div><br></div><div><br></div><div>That's the only way out of the misery of software bugs in general -- nothing special here ;-)</div><div><br></div><div>Python is a dynamically typed language -- EVERYTHING could do something unexpected if you pass in different type, or shape of array or whatever than you expect. If you want type safety -- use something else ;-)</div><div><br></div><div>I'm sorry out had a hard time with a particular bug -- but for me, I find broadcasting errors to usually be about as shallow as type errors -- which is to say usually found early and easily.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12.0px"><div>Providing optional warnings just would be an elegant way out of this.</div>
<div></div></div></div></blockquote><div><br></div><div>Broadcasting is widely used in numpy code -- a huge pile of warnings would be really painful!</div><div><br></div><div>Do you realize that:</div><div><br></div><div>arr = np.ones((5,))</div><div><br></div><div>ar2 = arr * 5</div><div><br></div><div>is broadcasting, too?</div><div><br></div><div>-CHB</div><div><br></div><div><br></div></div><div><br></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>