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

Anna Petrášová kratochanna at gmail.com
Thu Jul 14 05:28:20 PDT 2016


On Thu, Jul 14, 2016 at 11:20 AM, Martin Landa <landa.martin at 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 at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list