We have a file, where we have constant definitions and there are a lot of them. When there is a name collision, python assigns a new value to it without warning that constant with such name already exists. This is a potential source of bugs. Static code analyzers we use did not find it (Sonarqube and pylint). How to make sure that there are no name collisions?
PS: PyCharm raises "Redeclared defined above without usage", but I don't use PyCharm.
As Olvin Roght said use typing.Final
Note that this will return an error in your type checker but the code would still run and the value would still change.
This requires Python 3.8+
Alternatively you can do: