Why python doesn't use syntax like function(, , x) for default parameters?

Antoon Pardon apardon at forel.vub.ac.be
Fri Mar 10 10:20:25 EST 2006


Op 2006-03-10, Diez B. Roggisch schreef <deets at nospam.web.de>:
> Antoon Pardon wrote:
>
>>>
>>> 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:
>> 
>>   func(,,4)
>> 
>> We sure don't seem to have a problem with figuring out things like
>> 
>>   lst[::2]
>
> That is the usual polemics. Its a HUGE difference if I'm supposed to
> remember 2 default values that are 0 and <size-of-sequence>, in a
> specialized syntax,

Those default values are not 0 and <size-of-sequence>, you may have
only experience with situations where they behave as such but that
is not the same.

> than arbitrary values
> f(,,,,,3)
>
> in some arbitrary function. 

If you need to know these values then you will need to know them
just as much when a keyword is used or when the default values
are used later. Calling

  f(3) or f(arg5=3)

Will give you no more a clue about the missing default values
than calling

  f(,,,,,3)

At least in the last call you are given a clue about missing
arguments.

-- 
Antoon Pardon



More information about the Python-list mailing list