gdal icon indicating copy to clipboard operation
gdal copied to clipboard

Expose argument names to Python bindings

Open dbaston opened this issue 2 months ago • 1 comments

Feature description

Most Python functions currently have a signature (*args,**kwargs). This is a result of the SWIG feature compactdefaultargs, which is both turned on globally in several .i files using %feature("compactdefaultargs"), and turned on automatically by SWIG whenever %feature("kwargs") is used (some 400 instances). Many invocations of %feature("kwargs") are enabled only for certain languages, for reasons that are not always clear.

Full signatures (such as def OpenEx(utf8_path, nOpenFlags=0, allowed_drivers=None, open_options=None, sibling_files=None)) can be obtained by disabling compactdefaultargs using %feature("compactdefaultargs", "") and re-enabling it only for the handful of functions that require it for overload resolution. (SWIG warnings indicate which functions are affected.)

Additional context

No response

dbaston avatar Sep 30 '25 13:09 dbaston

An advantage of having the parameter names available in the Python bindings will be that IDEs will be able to show the parameters interactively, as the IDLE example below.

Image

geographika avatar Sep 30 '25 13:09 geographika