[GRASS-dev] pythonlib: parser() type casting

Martin Landa landa.martin at gmail.com
Thu Jul 14 02:20:54 PDT 2016


Dear all,

currently parser() in Python scripting library returns answer as a
string regardless of option type. I would suggest to modify the python
parser function to automatically cast answer if option type is
defined. Eg.

key: option1
type: int

key: option2
type: string

key: option3
(type not defined)

opt, flg = grass.parser()

print (opt)
{ 'option1': 1, 'option2: 'ciao', 'option3': '1' }

Current behaviour is:

{ 'option1': '1', 'option2: 'ciao', 'option3': '1' }
                     ^
                      |

Any comments? Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


More information about the grass-dev mailing list