> > > 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".
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/YQ2RTKOYSV4TZCYCTBST7E76BDD75DJ5/ Code of Conduct: http://python.org/psf/codeofconduct/