What is a static method in Python?

Experience Level: Junior
Tags: Python

Answer

Static method is a method that is decorated by @staticmethod decorator.

It is a method that doesn't know anything about state of the class it is defined in. It's not able to read class values. It only accepts values passed by parameters and optionally return a value.

Python for beginners
Python for beginners

Are you learning Python ? Try our test we designed to help you progress faster.

Test yourself