Skip to content

Methods

Vinicius Reif Biavatti edited this page Jul 25, 2022 · 1 revision
  • Use a good representation name
  • Use underscore to separate
  • Use type hints
  • Do not use camel case
  • Do not use special symbols
  • Instance methods should have their first parameter named 'self'.
  • Class methods should have their first parameter named 'cls'
  • Static methods don't need to have a default first parameter
  • Do not use capital letters

✅ Do

class DataProcessor:
    def process_data(self) -> None:
        ...

    @classmethod
    def create(cls) -> 'DataProcessor':
        ...

    @staticmethod
    def version() -> float:
        ...
Clone this wiki locally