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

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

On Thu, Jul 14, 2016 at 11:20 AM, Martin Landa <landa.martin@gmail.com> wrote:

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

+1

Anna

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev