How to Define Static Method in Python

  1. do not sign the static method with self
  2. use the class prefix for accessing Class attributes
  3. use the class prefix for calling static methods
  • they simply allow us to group a function within the class block when the function is conceptually related to the class

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pavol Kutaj

Pavol Kutaj

Infrastructure Support Engineer/Technical Writer (Snowplow Analytics) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com