This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyArg_ParseTupleAndKeywords is misnamed
Type: enhancement Stage:
Components: None Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum
Priority: low Keywords:

Created on 2001-04-06 18:11 by anonymous, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (2)
msg53129 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-04-06 18:11
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.
msg53130 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-04-07 17:48
Logged In: YES 
user_id=6380

Thanks for the rant.  I think I disagree on your
interpretation of the terminology. if you want to accept
*arbitrary* keywords, you can already do that, just don't
call PyArg_ParseTupleAndKeywords(): the third argument to
your C function is a dictionary that gets all keyword
arguments passed in by the caller.
History
Date User Action Args
2022-04-10 16:03:56adminsetgithub: 34292
2001-04-06 18:11:04anonymouscreate