[Types-sig] Keyword arg declarations
Guido van Rossum
guido@CNRI.Reston.VA.US
Fri, 17 Dec 1999 09:42:35 -0500
I just realized that Tim's decl syntax that's currently being bandied
around doesn't declare the names of arguments. That's fine for a
language like C, but in Python, any argument with a name (*args
excluded) can be used as a keyword argument.
I think it will be useful for the decl syntax to allow leaving out or
supplying argument names -- that tells whether keyword arguments are
allowed for this particular function. And that is part of a
function's signature.
(Note that not all builtins support keyword arguments; in fact most
don't.)
(Un)related: I think it makes sense to be able to restrict the types
of *varargs arguments. E.g. eons ago (last week in the types-sig)
someone proposed an extension to isinstance() allowing one to write
isinstance(x, type1, type2, type3, ...). Clearly the varargs are all
type objects here.
Not so sure about **kwargs, but these should probably be treated the
same way.
--Guido van Rossum (home page: http://www.python.org/~guido/)