<div dir="auto"><div>Here's a function found online (I'm too lazy to write my own, but it would be mostly the same). Tell me how keyword arguments could help this... Or WHAT names you'd give.<div dir="auto"><br></div><div dir="auto"><ol style="margin-top:0px;margin-bottom:0px;color:rgb(51,51,51);font-family:menlo,monaco,consolas,"courier new",monospace;font-size:14.4px;white-space:pre"><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,136)">def</span><span style="color:rgb(0,0,0)"> quad</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">a</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)">b</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)">c</span><span style="color:rgb(102,102,0)">):</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">    </span><span style="color:rgb(0,136,0)">"""solves quadratic equations of the form</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,136,0)">        aX^2+bX+c, inputs a,b,c,</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,136,0)">        works for all roots(real or complex)"""</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">    root</span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,0,0)">b</span><span style="color:rgb(102,102,0)">**</span><span style="color:rgb(0,102,102)">2</span><span style="color:rgb(102,102,0)">-</span><span style="color:rgb(0,102,102)">4</span><span style="color:rgb(102,102,0)">*</span><span style="color:rgb(0,0,0)">a</span><span style="color:rgb(102,102,0)">*</span><span style="color:rgb(0,0,0)">c</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">    </span><span style="color:rgb(0,0,136)">if</span><span style="color:rgb(0,0,0)"> root </span><span style="color:rgb(102,102,0)"><</span><span style="color:rgb(0,102,102)">0</span><span style="color:rgb(102,102,0)">:</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        root</span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,0,0)">abs</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">complex</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">root</span><span style="color:rgb(102,102,0)">))</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        j</span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,0,0)">complex</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,102,102)">0</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,102,102)">1</span><span style="color:rgb(102,102,0)">)</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        x1</span><span style="color:rgb(102,102,0)">=(-</span><span style="color:rgb(0,0,0)">b</span><span style="color:rgb(102,102,0)">+</span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(102,102,0)">+</span><span style="color:rgb(0,0,0)">sqrt</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">root</span><span style="color:rgb(102,102,0)">))/</span><span style="color:rgb(0,102,102)">2</span><span style="color:rgb(102,102,0)">*</span><span style="color:rgb(0,0,0)">a</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        x2</span><span style="color:rgb(102,102,0)">=(-</span><span style="color:rgb(0,0,0)">b</span><span style="color:rgb(102,102,0)">-</span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(102,102,0)">+</span><span style="color:rgb(0,0,0)">sqrt</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">root</span><span style="color:rgb(102,102,0)">))/</span><span style="color:rgb(0,102,102)">2</span><span style="color:rgb(102,102,0)">*</span><span style="color:rgb(0,0,0)">a</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        </span><span style="color:rgb(0,0,136)">return</span><span style="color:rgb(0,0,0)"> x1</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)">x2</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">    </span><span style="color:rgb(0,0,136)">else</span><span style="color:rgb(102,102,0)">:</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        x1</span><span style="color:rgb(102,102,0)">=(-</span><span style="color:rgb(0,0,0)">b</span><span style="color:rgb(102,102,0)">+</span><span style="color:rgb(0,0,0)">sqrt</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">root</span><span style="color:rgb(102,102,0)">))/</span><span style="color:rgb(0,102,102)">2</span><span style="color:rgb(102,102,0)">*</span><span style="color:rgb(0,0,0)">a</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        x2</span><span style="color:rgb(102,102,0)">=(-</span><span style="color:rgb(0,0,0)">b</span><span style="color:rgb(102,102,0)">-</span><span style="color:rgb(0,0,0)">sqrt</span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">root</span><span style="color:rgb(102,102,0)">))/</span><span style="color:rgb(0,102,102)">2</span><span style="color:rgb(102,102,0)">*</span><span style="color:rgb(0,0,0)">a</span></code></li><li style="list-style-type:decimal!important"><code style="font-family:menlo,monaco,consolas,"courier new",monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;white-space:pre-wrap"><span style="color:rgb(0,0,0)">        </span><span style="color:rgb(0,0,136)">return</span><span style="color:rgb(0,0,0)"> x1</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)">x2</span></code></li></ol></div><div dir="auto"><br></div>After that, explain why forcing all callers to name their local variables a, b, c would be a good thing.<br><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 7, 2018, 12:18 PM Robert Vanden Eynde <<a href="mailto:robertve92@gmail.com">robertve92@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I disagree.  Keyword arguments are a fine and good thing, but they are <br>
best used for optional arguments IMHO.  Verbosity for the sake of <br>
verbosity is not a good thing.</blockquote></div></div><div dir="auto"><br></div><div dir="auto">I disagree, when you have more than one parameter it's sometimes complicated to remember the order. Therefore, when you name your args, you have way less probability of passing the wrong variable, even with only one arg.</div><div dir="auto"><br></div><div dir="auto">Verbosity adds redundancy, so that both caller and callee are sure they mean the same thing.</div><div dir="auto"><br></div><div dir="auto">That's why Java has types everywhere, such that the "declaration part" and the "use" part agree on the same idea (same type).</div></div>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div></div></div>