Pylint invalid constant name

前端 未结 3 1270
Happy的楠姐
Happy的楠姐 2021-01-31 06:39

I\'m receiving a Pylint error regarding my constant: MIN_SOIL_PARTICLE_DENS (invalid name). Any ideas why this constant is wrong? Here\'s my full function:

3条回答
  •  花落未央
    2021-01-31 07:45

    Few simple rules :

    1. Constants should be defined with UPPER_CASE letters only and should be defined at the module level
    2. Class names should be defined with CamelCase letters
    3. Variables should be defined at lower_case and should be defined inside function, classes etc.

    Now lets talk about your case,

    MIN_SOIL_PARTICLE_DENS is defined inside a function and should have lower letters only. Thus instead of considering MIN_SOIL_PARTICLE_DENS as a constant, pylint considers it as a variable here and hence the pylint error.

    Pylint Tutorial

提交回复
热议问题