I'm making a game in Python, and it makes sense to have one of my modules named 'map'. My preferred way of importing is to do this:
from mygame import map
As pylint is telling me, however, this is redefining a built-in. What's the common way of dealing with this? Here are the choices I can come up with:
1) Ignore the pylint warning since I don't use the built-in map anyway.
2) Change to:
import mygame
then reference as mygame.map throughout my code.
3) Rename my map module to something else (hexmap, gamemap, etc.)
I'm leaning towards (2) but I want to see what other people think.
This is subjective; there's no right answer.
That said, for me 3 is the only sensible option. Really really don't do 1; overwriting builtins is almost never a good idea and in this case it's especially confusing. 2 is better, but I think there is still an expectation that any function called map
performs some operation similar to that of the builtin.
Maybe mapping
?