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

Antoine Pitrou solipsis at pitrou.net
Sun Mar 4 01:55:02 CET 2012


On Sat, 3 Mar 2012 09:54:03 -0800
Guido van Rossum <guido at python.org> wrote:
> 
> > I hope in the future that we find ways to simplify function signatures
> > in a way that make them both easier to use and more efficient for the
> > function user, rather than continue adding specific little tweaks that
> > give the function designer more control over how the function user calls
> > it.
> 
> You seem to forget that API design is an art and that it is the
> function author's prerogative to design an API that minimizes mistakes
> for all users of the function. Sometimes that includes requiring that
> everyone uses positional arguments for a certain situation.

Those situations are probably very rare. AFAIK we haven't seen anyone
mention a serious use case. I think concerns of built-in functions
shadowed by Python functions or the reverse are mostly academic, since
we don't see anyone complaining about dict-alikes accepting keyword
args.

(besides, what happened to "consenting adults"? :-))

> Anyway, I now think that adding a built-in @positional(N) decorator
> makes the most sense since it doesn't require changes to the parser.

-1 on a built-in for that. The functools module would probably be a
good recipient (assuming the decorator is useful at all, of course).

Regards

Antoine.





More information about the Python-ideas mailing list