[Python-ideas] Keyword only argument on function call

Anders Hovmöller boxed at killingar.net
Wed Sep 12 09:15:24 EDT 2018



> On 8 Sep 2018, at 14:23, Anders Hovmöller <boxed at killingar.net> wrote:
> 
>> To me, the "30% of all arguments" deserves more careful examination.
>> Does the proposal significant improve the reading and writing of this
>> code? And are there other, perhaps better, ways of improving this
>> code?
> 
> Maybe my tool should be expanded to produce more nuanced data? Like how many of those 30% are:
> 
> - arity 1,2,3, etc? (Arity 1 maybe should be discarded as being counted unfairly? I don’t think so but some clearly do)
> - matches 1 argument, 2,3,4 etc? Matching just one is of less value than matching 5. 
> 
> Maybe some other statistics?


I've updated the tool to also print statistics on how many arguments there are for the places where it can perform the analysis. 

I also added statistics for how long variable names it finds. I'm pretty sure almost all places with the length 1 or 2 for variable names passed would be better if they had been synchronized. Those places are also an argument for my suggestion I think, because if you gain something to synchronize then that will make you less likely to shorten variable names down to 1 or 2 characters to get brevity. Maybe...

If you exclude calls to functions with just one argument (not parameters) then the hit percentage on the code base at work drops from ~36% to ~31%. Not a big difference overall.

I've updated the gist: https://gist.github.com/boxed/610b2ba73066c96e9781aed7c0c0b25c <https://gist.github.com/boxed/610b2ba73066c96e9781aed7c0c0b25c>

/ Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180912/13e0fe24/attachment.html>


More information about the Python-ideas mailing list