[Python-Dev] keyword-only arguments (was Re: string slicing and method consistency)
Guido van Rossum
guido@digicool.com
Mon, 23 Apr 2001 09:36:44 -0500
> Wouldn't it be nice if we could force particular arguments to be used as
> keyword arguments only ? :)
You could do this manually using **kwds (or its C equivalent), but it
gets ugly.
> I remember this coming up a few times on
> python-list, but I never quite understood why this isn't done. Syntax
> doesn't seem too much of a problem ('def split(s, sep, **, maxsplit=0)'
> comes to mind, and a new marker for PyArg_ParseTuple, like "**") and now
> that we have warnings and __future__, we could phase it in even for oft-used
> things such as string.split().
>
> Even if it's deemed dubious hypergeneralization (look ma, no macro ;) it's
> worth writing a PEP about, right ?
Sure. My main problem with it is that I doubt how often it is useful,
compared to the cost of adding the syntax and new code generation
necessary. I don't think that ** is the right separator, but I don't
have a better suggestion.
--Guido van Rossum (home page: http://www.python.org/~guido/)