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

Guido van Rossum guido at python.org
Sat Mar 3 04:36:39 CET 2012

On Fri, Mar 2, 2012 at 7:20 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Raymond Hettinger wrote:
>> On Mar 2, 2012, at 2:01 PM, Gregory P. Smith wrote:
>>> speaking of range... I think start and stop are plenty obvious, but I'd
>>> like to allow step to be specified as a keyword.
>> range() has been around 20+ years and this has never been requested.
> I have frequently felt that range(start=5, stop=27, step=2) reads better
> than range(5, 27, 2), but not better *enough* to bother requesting a change,
> particular given the conservative nature of the Python devs to such minor
> interface changes (and rightly so).
> If it came to a vote, I'd vote 0 on the status quo, +0 to allow all three
> arguments to be optionally given by keyword, and -1 for singling step out as
> the only one that can be a keyword. That's just silly (sorry Gregory!) --
> can you imagine explaining to a beginner why they can write range(0, 50, 2)
> or range(0, 50, step=2) but not range(0, stop=50, step=2)?

There's no need to explain anything to beginners, they just accept
whatever rules you give them. It's the people who are no longer
beginners but not quite experts you have to deal with. But a true zen
master, even a zen-of-Python master, would just hit them over the head
with a wooden plank. (Seriously, there are plenty of APIs that have
some positional parameters and some keyword parameters, and I see
nothing wrong with that. You seem to be too in love with keyword
parameters to see clearly. :-)

Still, I can't think of a reason why we should upset Raymond over such
a minor thing, so let's forget about "fixing" range. And that's final.

--Guido van Rossum (python.org/~guido)

More information about the Python-ideas mailing list