[New-bugs-announce] [issue26282] Add support for partial keyword arguments in extension functions

Serhiy Storchaka report at bugs.python.org
Wed Feb 3 16:44:16 EST 2016


New submission from Serhiy Storchaka:

Currently extension functions either accept only positional-only arguments (PyArg_ParseTuple), or keyword arguments (PyArg_ParseTupleAndKeywords). While adding support passing by keywords looks good for some arguments, for other arguments it doesn't make much sense. For example "encoding" and "errors" arguments for str or "base" argument for int are examples of good keyword arguments, but it is hard to choose good name for the first argument.

I suggest to allow to add the support of keyword arguments only for the part of arguments, while left other arguments positional-only. This issue consists from two stages:

1. Allow PyArg_ParseTupleAndKeywords to accept empty string "" as keywords and interpret this as positional-only argument.

2. Make Argument Clinic to generate code for partial keyword arguments. The syntax already supports this: "/" separates positional-only arguments from keyword arguments.

----------
messages: 259521
nosy: larry, martin.panter, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add support for partial keyword arguments in extension functions
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26282>
_______________________________________


More information about the New-bugs-announce mailing list