[Python-ideas] keyword arguments everywhere (stdlib) - issue8706

Chris Rebert pyideas at rebertia.com
Sat Mar 3 01:01:08 CET 2012

On Fri, Mar 2, 2012 at 3:42 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Sat, Mar 3, 2012 at 5:28 AM, Guido van Rossum <guido at python.org> wrote:
>> I would actually like to see a syntactic feature to state that an
>> argument *cannot* be given as a keyword argument (just as we already
>> added syntax to state that it *must* be a keyword).
> I currently write such code as:
>     def f(*args):
>         arg1, arg2, arg3 = args
> This gives rubbish error messages when the caller makes a mistake, but it works.
> The obvious syntactic alternative is allowing tuple expansion
> specifically for *args:
>   def f(*(arg1, arg2, arg3)):
>      pass
> Then the interpreter would have enough info to still generate nice
> error messages, and we don't have to invent much in the way of new
> syntax.

Kinda incongruous with PEP 3113 though.

- Chris

More information about the Python-ideas mailing list