[GRASS-dev] pythonlib: map

Hi,

most of the functions from python scripting library use parameter
named 'map'. It's reserved word in python, in the result it's
complicated to use e.g. map() fn. I would suggest to replace this
parameter by 'name' or something similar.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

2010/12/29 Martin Landa <landa.martin@gmail.com>:

Hi,

most of the functions from python scripting library use parameter
named 'map'. It's reserved word in python, in the result it's
complicated to use e.g. map() fn. I would suggest to replace this
parameter by 'name' or something similar.

+1

Martin

regards
Luca

www.lucadelu.org

Martin Landa wrote:

most of the functions from python scripting library use parameter
named 'map'. It's reserved word in python, in the result it's
complicated to use e.g. map() fn. I would suggest to replace this
parameter by 'name' or something similar.

Parameter names only matter within the function itself, so it's only
an issue if you want to use the built-in "map" function within a
function with a parameter named "map" (e.g. for consistency with other
functions). In which case, you can use __builtins__.map, use a list
comprehension, copy the parameter then "del(map)", etc.

FWIW, I've yet to encounter an actual problem with using "map" as a
parameter or variable name. Likewise for min, max, file, type, input,
etc.

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

2010/12/30 Glynn Clements <glynn@gclements.plus.com>:

most of the functions from python scripting library use parameter
named 'map'. It's reserved word in python, in the result it's
complicated to use e.g. map() fn. I would suggest to replace this
parameter by 'name' or something similar.

Parameter names only matter within the function itself, so it's only
an issue if you want to use the built-in "map" function within a
function with a parameter named "map" (e.g. for consistency with other
functions). In which case, you can use __builtins__.map, use a list
comprehension, copy the parameter then "del(map)", etc.

FWIW, I've yet to encounter an actual problem with using "map" as a
parameter or variable name. Likewise for min, max, file, type, input,
etc.

Right, that's question. To keep parameter consistency with GRASS
modules has probably the higher priority. I have modified
vector_what() in this regard.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa