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

Nick Coghlan ncoghlan at gmail.com
Fri Mar 2 13:13:13 CET 2012

On Fri, Mar 2, 2012 at 6:43 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> +1 on adding keyword arguments to built-in methods and functions where they
> would help readability, e.g str.find(c, start=23), even if this happens in a
> ad-hoc fashion.

Indeed, this is the approach we have taken to date. For example,
str.split() recently gained keyword support for 3.3 because
"text.split(maxsplit=1)" is less cryptic than "text.split(None, 1)".

It makes the most sense when at least one of the following holds:
- the second argument accepts a number that is unclear if you're not
familiar with the full function signature
- the earlier arguments have sensible default values that you'd prefer
not to override

So +1 on declaring "make X support keyword arguments"
non-controversial for multi-argument functions, +0 on also doing so
for single argument functions, but -0 on attempting to boil the ocean
and fix them wholesale.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list