[GRASS-dev] pythonlib: map

Glynn Clements glynn at gclements.plus.com
Wed Dec 29 18:53:20 EST 2010


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 at gclements.plus.com>


More information about the grass-dev mailing list