[GRASS-dev] g.parser: Note on setting bash' IFS to parse separate identities

Glynn Clements glynn at gclements.plus.com
Wed Nov 5 03:12:59 PST 2014

Nikos Alexandris wrote:

> By the way, in Python, is   .split(',')   the only way to seprate 
> multiple (input) identities in a list/dictionary? Shouldn't the parser, 
> with the option "multiple: yes" do this already for the scripter?

grass.script.parser() doesn't examine the script's interface; it just
invokes g.parser and parses the result.

At present, having the parser examine the interface would require
either replicating the g.parser logic within grass.script, or invoking
the module with --interface-description and parsing the resulting XML. 

If we want to relieve the scripts of the burden of parsing option
values, it would make more sense to extend g.parser to include type
information in the data it sends back to the script.

The question is, how much type information do we want to use. There
are at least 3 factors:

1. opt->multiple => convert the value to a list.
2. opt->type => convert value(s) to int/float.
3. opt->key_desc includes commas => convert values to tuples

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list