Normal methods should have at least one parameter and the first parameter should be called self.

Ensure that the first parameter of a normal method is named self, as recommended by the style guidelines in PEP 8.

If a self parameter is unneeded, the method should be decorated with staticmethod, or moved out of the class as a regular function.

In the following cases, the first argument of Point.__init__ is named val instead; whereas in Point2.__init__ it is correctly named self.

  • Python PEP 8: Function and method arguments.
  • Python Tutorial: Classes.
  • Python Docs: staticmethod.