[pylint] why pylint wants only capitals identifiers?
jeanmichel at sequans.com
Mon Apr 19 16:21:04 CEST 2010
Giacomo Boffi wrote:
> i have this code
> def example(a):
> return lambda b: a+b+1
> fun = example(10)
> k_1 = fun(7)
> and pylint tells me
> C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
> C: 5: Invalid name "k_1" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
> afaict, [A-Z_][A-Z0-9_]* identifiers should be used for constants, and
> i don't think of fun or k_1 as constants... what's going on?
Pylint default rules need some tuning, it's highly configurable for that
Some ppl like to think 'module variables' are constants thus should be
upper case. If you disagree with that statement like I do, you can
simply rewrite the regexp for module variables.
However, given you example, you should not insert code execution at you
module level, unless it's required only at the module import. I dont
know what is your module purpose but I bet it has no legitimate
More information about the Python-list