[Qgis-user] QGIS custom python function with zero or more args

Fuenfer-Koenigstein.Benjamin2 at swm.de Fuenfer-Koenigstein.Benjamin2 at swm.de
Fri Mar 9 00:18:52 PST 2018


Hi all,

I would like to write a custom python function for QGIS 2.18 that takes zero or one argument. The reason is that in most cases I can use a default value in the function, in some cases I would like to enter the value as argument. For python I know that you can prefix args in functions to make them optional, e.g. def func(*arg). For QGIS functions this will not work because there always have to be the args feature and parent in last two positions. Has anyone experience with QGIS functions that take zero or more arguments? Thanks for any help!

Regards
Benjamin


More information about the Qgis-user mailing list