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

Dmitry Anikin anikin#remove_this# at vstu.ru
Fri Mar 10 04:06:57 EST 2006


I mean, it's very convenient when default parameters
can be in any position, like
def a_func(x = 2, y = 1, z):
    ...
(that defaults must go last is really a C++ quirk which
is needed for overload resolution, isn't it?)

and when calling, just omit parameter when you want to
use defaults:
a_func(, , 3)

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.

Is there some contradiction in python syntax which disallows
an easy implementation of this feature, or just nobody bothered
with this? If former is the case, please show me why, because
I badly need this feature in embedded python app (for
compatibility with other language that uses such syntax) and might
venture to implement it myself, so don't want to waste time
if it's gonna break something.
Or maybe it might be an idea for enhancement proposal?




More information about the Python-list mailing list