'pylint invalid name error (C0103) doesn't follow python conventions

I have a private variable in a class - _expected_substring_result .
This is the line 26 in my module, which is part of my init function - self._expected_substring_result = _expected_substring_result.

This is the error I'm getting from lint-python - ..\endpoint.py:26:4: C0103: Attribute name "_expected_substring_result" doesn't conform to '[a-z_][a-z0-9_]{0,30}$' pattern (invalid-name) .

This doesn't make sense - a private field in python is supposed to begin with an underscore.
I know how to fix it, by either editing the linter config, or adding # pylint: disable=invalid-name. But this seems too odd an issue to just be something the pylint devs forgot about.

Is this a bug, or am I missing something ?
Thanks,



Solution 1:[1]

pylint 3.0.0-a4 doesn't find your error in this code snippet below. Please provide your __init__ for further investigation :)

class Hi:
    def __init__(self, _expected_substring_result):
        self._expected_substring_result = _expected_substring_result

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Denis Barmenkov