<br><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 13, 2018, 11:58 PM Anders Hovmöller <<a href="mailto:boxed@killingar.net">boxed@killingar.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div>In that case, you should be able to link to a compelling example. If you go to the trouble of finding one, I'll take time to try to refactor it.</div></div></div></div></blockquote></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><a href="https://github.com/django/django/blob/master/django/db/models/sql/compiler.py#L707" target="_blank">https://github.com/django/django/blob/master/django/db/models/sql/compiler.py#L707</a></div></div><div><br></div><div>Is a pretty typical one.</div></div></blockquote><div><br></div><div>That call is recursive, so it's unlikely that the author would shift the parameters around without testing the call and changing the argument positions appropriately.</div></div></div></blockquote><div><br></div>Maybe. Still it would be better with keyword arguments. Testing is one thing, quickly finding problems is another. Keyword arguments fail fast and cleanly with signature changes, positional arguments only do when you add or remove parameters at the very end, all other changes are potentially very annoying to debug because you can get a long way past the problem call site before hitting a type or behavior error.</div><div><br></div><div>I'm not sure we even agree on this basic point though. Do you agree on that?<br></div></div></blockquote></div><div><br></div><div>I agree those are benefits to keyword arguments, but I disagree that those benefits accrue in all cases. I do not believe that keyword arguments are strictly better than positional.</div><div><br></div><div>Maybe our difference of opinion stems from tooling and the way others refactor the code we work on.</div><div><br></div><div>I enjoy using keywords to explain the values I'm passing. If I already have a well-named variable, I'm less keen on using a keyword.</div><div><br></div><div><br></div><div>Here's a possible refactor. I didn't bother with keyword arguments, because the variable names are easy to match up with arguments positionally. My screen was large enough that I could read the signature at the same time as I wrote the call.</div><div><br>    def recurse(name):</div><div>    return self.find_ordering_name(name, opts, alias, order, already_seen)</div><div>return itertools.chain.from_iterable(map(recurse, opts.ordering))<br></div><div><br></div><div><br></div><div><br></div><div class="gmail_quote"></div>