I’m new to python using pycharm as my IDE to work with Gramps. Pycharm is giving me lots of warnings about the code using PEB 8. Most of it I can understand and have made changes to the code to clean it up so no warnings are showing. But one has me stumped and I can’t find anything on the web to fix it. It’s the Constant variable imported as non-constant warning being generated by the code
from gramps.gen.const import GRAMPS_LOCALE as glocale
I know I can ignore it but I would like to fix it if I can. Must be my OCD causing me to dwell on it.
In addition there is no true constant symbol in Python because the notion doesn’t exist. The “constant semantics” is purely a convention and nothing forbids you from assigning a new value to a “constant” symbol (written in uppercase). Only ancillary tools will detect the violation of the convention. The Python interpreter will blindly execute the change of value.
and as I’m cleaning up files, I’m changing GRAMPS_LOCALE to lower case as I go through files. I know I can do a find and replace but I’m testing to see if I break anything before I proceed. I was taught an error or warning message should be fixed and not ignored so I’m doing that as I go along. Being new to Python, still trying to learn why some things are done the way they are in Gramps.
Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL .