[QGIS-Developer] Keyword args for python bindings?
nyall.dawson at gmail.com
Wed Jun 21 20:13:18 PDT 2017
On 22 June 2017 at 12:36, Nathan Woodrow <madmanwoo at gmail.com> wrote:
> I thought I turned that on a while ago?
> IMO +1 on this because it makes things nicer to read.
Ahh - I see what's happening here. At the module level we've enabled
keyword_arguments="Optional", which means only arguments with a
default value can be referred to by keyword. I must have tested
arguments without default values.
I'd like to change this to "All" for consistency (and readability).
> On Thu, Jun 22, 2017 at 12:33 PM, Nyall Dawson <nyall.dawson at gmail.com>
>> Hi all,
>> Been thinking about this lately, with all the excellent work which is
>> being done on sipify and improving the usability of the PyQGIS through
>> docstrings and such... do we want to also turn on named argument
>> support for PyQGIS methods?
>> I gather it's just a matter of adding the annotation KeywordArgs=All
>> to function definitions. We should be able to code this into sipify to
>> handle this automatically.
>> I'd see the big benefit here would be readability of python code - no
>> more someMethod( True,False, 5, None) deciphering!
>> The downside would be that the argument names would become part of
>> stable API. We've still gots lots of unhelpful argument names (things
>> like 's', 'c',.... ), so that's a potential downside if these get
>> locked in (although maybe we can fix them before freeze).
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the QGIS-Developer