
What's the advantage of a mode switch? This seems perfectly clear to
me without any sort of magical cutoff.
I agree with Chris. I'm not a fan of the original proposal with the "=" (because I don't think this is a problem that needs solving), but at least it made more sense than a mode-switch among the list of parameters.
Eric
What's the advantage of a mode switch? This seems perfectly clear to
me without any sort of magical cutoff.
ChrisA
Here's a specific advantage I had in mind (it might not be considered very significant for many and that's ok): copying and pasting.
If I have a function I want to call, sometimes I'll often hyper-click through to the function and copy the signature instead of typing it all out.
I do this to save a little typing but also in large part so that I have the entire function signature right in front of me while I type out the function call, and that helps prevent little errors-- forgetting a parameter or calling one incorrectly, that sort of thing.
So if you had a function like this:
def f(a, b, *, c=None, d=None, e=None, f=None, g=None): ...
And wanted to call it like this:
f(a=a, b=b, c=c, g=g)
An easy way to reliably type the call is to copy the function signature, delete the parts you aren't going to use, and then type all of the "=a", "=b", etc parts.
A nice thing about the mode switch syntax could be that it makes this routine faster (assuming there are no type hints!!!):
f(*, a, b, c, g)
All you have to do is add the *, delete the parts you don't need, and you're done.
This is a small thing. But it got me excited about the proposed syntax.
Sorry: for clarity, I understand the keyword-only parts are the only ones you currently *MUST* type "=c", "=g" for. I should have not said "=a" and "=b".