[Python-Dev] PEP 3102: Keyword-only arguments
Fredrik Lundh
fredrik at pythonware.com
Mon May 1 15:04:01 CEST 2006
Edward Loper wrote:
> > One reason I see is to have keyword-only functions, i.e. with no
> > positional arguments at all:
> >
> > def make_person(*, name, age, phone, location):
> > pass
> >
> > which also works for methods:
> >
> > def make_person(self, *, name, age, phone, location):
> > pass
> >
> > In these cases, you don't *want* name, age to be passed in a positional
> > way. How else would you formulate that if this syntax wasn't available?
>
> But is it necessary to syntactically *enforce* that the arguments be
> used as keywords? I.e., why not just document that the arguments should
> be used as keyword arguments, and leave it at that.
and how do you best do that, in a way that automatic introspection
tools understand, unless you invent some kind of standard syntax for
it?
and if you have a standard syntax for it, why not support it at the
interpreter level ?
</F>
More information about the Python-Dev
mailing list