[Python-ideas] Keyword only argument on function call

Anders Hovmöller boxed at killingar.net
Tue Sep 25 06:30:45 EDT 2018


Hi,

I'd like to reopen this discussion if anyone is interested. Some things 
have changed since I wrote my original proposal so I'll first summarize:

1. People seem to prefer the syntax `foo(=a)` over the syntax I suggested. 
I believe this is even more trivial to implement in CPython than my 
original proposal anyway...
2. I have updated my analysis tool: 
https://gist.github.com/boxed/610b2ba73066c96e9781aed7c0c0b25c  It will now 
also give you statistics on the number of arguments function calls have. I 
would love to see some statistics for other closed source programs you 
might be working on and how big those code bases are.
3. I have made a sort-of implementation with 
MacroPy: https://github.com/boxed/macro-kwargs/blob/master/test.py I think 
this is a dead end, but it was easy to implement and fun to try!
4. I have also recently had the idea that a foo=foo type pattern could be 
handled in for example PyCharm as a code folding feature (and maybe as a 
completion feature). 

I still think that changing Pythons syntax is the right way to go in the 
long run but with point 4 above one could experience what this feature 
would feel like without running a custom version of Python and without 
changing your code. I admit to a lot of trepidation about wading into 
PyCharms code though, I have tried to do this once before and I gave up.

Any thoughts?

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


More information about the Python-ideas mailing list