[Python-ideas] Make all switches keyword-only

Pablo Torres N. tn.pablo at gmail.com
Mon Jun 29 17:48:53 CEST 2009

Hello!  This is my first time posting to a python list, so be kind with
the newbie :-)

>From issue 6372:

"I propose that all formal parameters that really act as
options/switches be made keyword-only.  Examples of switches are all
flags, timeouts, 'verbose' bools, maximums and minimums, etc.

This stresses the difference between needed input for a function and an
argument that changes/extends the behavior.  Besides, the code would be
more readable, because instead of having some cryptic function call like
register('Pablo Torres', 2, 4, 5, False) you would have the prettier
register('Pablo Torres', hour=2, min=4, sec=5, had_reservation=False).

The implementation would just require putting a star '*' before all
options, according to pep 3102.

If needed, I can rewrite this as a PEP."

Since this would break pretty much all the code out there, I suspect
that we should come up with a warning mechanism first.  Maybe leave the
warning there for a couple of releases before making it definitive.

What do you guys think?

More information about the Python-ideas mailing list