Why does Pylint object to single-character variable names?

后端 未结 5 1795
我寻月下人不归
我寻月下人不归 2021-01-30 12:08

I\'m still getting used to Python conventions and using Pylint to make my code more Pythonic, but I\'m puzzled by the fact that Pylint doesn\'t like single character variable na

5条回答
  •  误落风尘
    2021-01-30 13:02

    Nowadays there is also an option to override regexp. I.e., if you want to allow single characters as variables:

    pylint --variable-rgx="[a-z0-9_]{1,30}$" 
    

    So, Pylint will match PEP8 and will not bring additional violations on top. Also you can add it to .pylintrc.

提交回复
热议问题