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?

tia,
                                                                g
Pylint default rules need some tuning, it's highly configurable for that purpose. 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 attribute 'fun'.

JM


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to