[GRASS-dev] how to deal with a python keyword as a module option name?

Hi,

r.resamp.bspline uses 'lambda' as a command line parameter name, but when
you try to use it with grass.run_command() you get an error as lambda is
a python reserved keyword. How to work around that?

(also it would be nice if v.surf.bspline and r.resamp.bspline could have the
same choice for sie,se sin,sn and lambda_i,lambda option key names in trunk)

thanks,
Hamish

Hamish wrote:

r.resamp.bspline uses 'lambda' as a command line parameter name, but when
you try to use it with grass.run_command() you get an error as lambda is
a python reserved keyword. How to work around that?

Prepend an underscore to the name, i.e.:

  grass.run_command('r.resamp.bspline', _lambda = ...)

--
Glynn Clements <glynn@gclements.plus.com>