In the answer to how to stop Pylint message C0103, @ChristopheD accurately mentioned that "pylint interprets all module-level variables as being 'constants'."
I like Pylint, and suppose that the authors have code-quality-encouraging reasons for its default behavior. So, can anyone tell me: why does pylint interpret all module-level variables as being 'constants'?
Is this perhaps pylint's way of highlighting implicit global variables, which are considered bad?
In answer Why is Global State so Evil? it is clarified that using global variables adds complexity and uncertainty since you don't know who accesses this global variable.
As stated in the answer it would also make your code less (unit)testable.
Declaring it as a constant is in linting terms more acceptable because when the variable/constant doesnt change you wouldn't have this uncertainty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With