Search code examples
pythonpep8flake8

flake8 and "old style class declaration"


I use flake8 to check formatting of my python3 scripts. When I declare classes like this...

class MyClass:

...I get a warning "H238 -- old style class declaration, use new style (inherit from object)".

However, the documentation clearly has declarations just like this: https://docs.python.org/3/tutorial/classes.html#class-definition-syntax

I think that inheriting from object looks unnecessarily cluttered. Is it functionally different? The documentation doesn't say anything about inheriting from object.

Is this a bug with flake8, or am I just missing something obvious?


Solution

  • The documentation says:

    It is very important to install Flake8 on the correct version of Python for your needs. If you want Flake8 to properly parse new language features in Python 3.5 (for example), you need it to be installed on 3.5 for Flake8 to understand those features. In many ways, Flake8 is tied to the version of Python on which it runs.