[Python-3000] How to specify keyword-only arguments from C?
Alexandre Vassalotti
alexandre at peadrop.com
Fri Jun 6 05:51:59 CEST 2008
On Thu, Jun 5, 2008 at 10:50 PM, Guido van Rossum <guido at python.org> wrote:
> I believe Alexandre is familiar with PyArg_ParseTupleAndKeywords(),
> but its API doesn't let you specify keywords that have no positional
> equivalent. He's after the C equivalent of
>
> def foo(*, a, b): ...
>
> where a and b *must* be specified as keywords by the caller.
Yes, that is what I was looking for. As Mark pointed out, the solution
is simply to check the size of the args tuple -- i.e., no special API
is required.
-- Alexandre
More information about the Python-3000
mailing list