This actually describes a mechanism for handling *optional arguments* using argument names, not true keyword handling. True keyword handling would allow specification of arbitrary values. For example, in Python code, I can have my functions accept arbitrary keyword arguments and pass them on to another function even if I don't understand them myself (Tkinter does this a lot). If I try to pass a keyword parameter named xyzzy to an *extension* module that only understands foo and bar parameters, though, I get an error. The only semi-reasonable alternative is to pass a normal argument that happens to be a dictionary of keyword arguments, but that's not really the same.
Ideally, extensions would be allowed to use true keywords. Failing that, the documentation should be amended to reflect the lesser functionality that PyArg_ParseTupleAndKeywords actually provides.
|