[Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

Michael Selik mike at selik.org
Thu Sep 13 22:12:26 EDT 2018

On Thu, Sep 13, 2018 at 6:50 PM Anders Hovmöller <boxed at killingar.net>

> On 14 Sep 2018, at 03:35, Michael Selik <mike at selik.org> wrote:
> 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.
> https://github.com/django/django/blob/master/django/db/models/sql/compiler.py#L707
> Is a pretty typical one.

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.

The signature uses the parameter "default_order" and the call uses the
argument "order". It seems that was a deliberate choice that wouldn't
conform to the `f(a=a)` pattern.

The call is oddly split across lines 707 and 708, despite nearby lines
being much longer. it could easily have been written as a single line.

I don't find this a compelling example.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180913/5240034b/attachment.html>

More information about the Python-ideas mailing list