keyword-arguments (was Re: Lambdas (was Re: [RFC] Draft Proposal for New Python Syntax))

Donald Beaudry (don@vicorp.com)
Fri, 27 May 94 15:04:08 EDT

>>>>> On Fri, 27 May 94 13:57:51 -0400, Tim Peters <tim@ksr.com> said:

> "by magic"; the recent keyword-argument extension to Python can be abused

keyword-argument extention? Did I miss something? I am aware of the
"default parameter" extention, which when I first saw it, made me
think that a keyword-argument-kind-of-thing would also be good.

What do I mean by a keyword-argument extention...

The function

def frobnicate(foo, bar, x = 10, y = 20, z = 30)
print foo, bar, x, y, z
end

can currently be called a few different way, like

frobnicate(f, b)
or
frobnicate(f, b, my_c)

for example. If you want to frobnicate a foo and a bar, but only want
to provide a z value that differs from the defaults, you are forced to
"figure out" what the defaults for x and y should be and then say

frobnicate(f, b, 10, 20, my_z)

I would rather say

frobnicate(f, b, z = my_z)

and not have to worry about the defaults. A feature like this would
make it practical to write and use functions that have a many default
parameter values.

B.T.W. I have completed and will soon be posting a patch that allows
the use of optionally required end statements. The patch is
completely backwards compatable at least to the extent of that covered
by the distributed regression test. I am starting to get the feeling
that nobody even cares anymore, but I have never let that stop me
before :)

--Don
______ ______
\_\_\_\ /#/#/#/
\_\_\_\ ______
\_\_\_V#/#/#/ Donald Beaudry don@vicorp.com
\_\_/#/#/#/ V. I. Corporation uunet!vicorp!don
\_/#/#/#/ 47 Pleasant Street PHONE: (413) 586-4144
V#/#/#/ Northampton, MA 01060 FAX: (413) 586-3805