I am trying to declare an object in Python. I am using Visual Studio Code with the basic pylint setup in it. Here is a snip of some code I have.
class MyLogging:
"""A class to initialize and run the logging commands using built in logging functions."""
def __init__(self):
etc...
my_can_logger = MyLogging()
Pylint keeps giving me an error that my_can_logger is named incorrectly.
[pylint] C0103:Invalid constant name "my_can_logger"
But I don't want it to be a constant! I want it to be an object. Is there some rule that I am missing? I looked at the PEP-8 styling guide, and I seem to be following their convention pretty well.
Thanks in advance
pylint thinks it's a constant because it's a module level variable. Just ignore pylint, it's being stupid. Using a module level object for the logger is a common pattern in Python.
Better linters such as flake8 or pyflakes won't give you these complaints.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With