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

Anders Hovmöller boxed at killingar.net
Fri Sep 14 03:30:47 EDT 2018

> On 14 Sep 2018, at 09:26, Michael Selik <mike at selik.org> wrote:
> On Fri, Sep 14, 2018, 12:17 AM Anders Hovmöller <boxed at killingar.net <mailto:boxed at killingar.net>> wrote:
> That's a bit of a dodge. There is a huge difference in verbosity between 
> handler.new_file(field_name, file_name, content_type, content_length, charset, content_type_extra)
> and 
> handler.new_file(field_name=field_name, file_name=file_name, content_type=content_type, content_length=content_length, charset=charset, content_type_extra=content_type_extra)
> Since neither version fits well on one line or even three, I'd have written each of those on a separate line, indented nicely to emphasize the repetition. Seems fine to me.

Sure. As would I. Doesn't change anything:


> The real problem with this code section wasn't the positional arguments, but that it was so heavily indented. Whenever I have code so nested, I put in a great deal of effort to refactor so that I can avoid the nesting of many try/except, for, and if/else statements.

Most code has many problems. Bringing up random other problems instead of sticking to the topic doesn't seem very helpful. Or did you want to change the topic to generally be about how to clean up code? If so I'd like to know so I can stop responding, because that's not what I am trying to discuss.

/ Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180914/a8fc0be6/attachment-0001.html>

More information about the Python-ideas mailing list