Why python doesn't use syntax like function(, , x) for default parameters?
apardon at forel.vub.ac.be
Fri Mar 10 14:46:58 CET 2006
Op 2006-03-10, Roy Smith schreef <roy at panix.com>:
> "Dmitry Anikin" <firstname.lastname@example.org> wrote:
>> There are often situations when a function has independent
>> parameters, all having reasonable defaults, and I want to
>> provide just several of them. In fact, I can do it using
>> keyword parameters, but it's rather long and you have to
>> remember/lookup names of parameters.
> Specifying the names of the keyword parameters costs you a little typing
> once, but saves everybody (including yourself) a lot of grief later when
> you're trying to figure out what the heck your code does 6 months later.
Could you explain what is so hard in figuring out:
We sure don't seem to have a problem with figuring out things like
Personnaly in a situation where it is likely that the first
parameter is going to take a default and the second parameter
is going to vary a lot, I would have prefered that to be
visible in how the function is called, instead of a call
with only one argument being interpreted as being the value
for the second parameter.
More specifically I would have preferred the possibility
of range(,n) and this being equivallent to range(0,n)
instead of range(n) being equivallent to range(0,n).
More information about the Python-list