OOP Method Types in Python: @classmethod vs @staticmethod vs Instance Methods

Dan Bader
Dan Bader 7 Lessons 14m intermediate python

What’s the difference between @classmethod, @staticmethod, and “plain/regular” instance methods in Python? You’ll know the answer after watching this video course:

  • Regular (instance) methods need a class instance and can access the instance through self. They can read and modify an objects state freely.

  • Class methods, marked with the @classmethod decorator, don’t need a class instance. They can’t access the instance (self) but they have access to the class itself via cls.

  • Static methods, marked with the @staticmethod decorator, don’t have access to cls or self. They work like regular functions but belong to the class’s namespace.

In this course you’ll go over the differences between these three kinds of methods in Python. You’ll also see when to use each with a simple example, so you can improve your object-oriented programming (OOP) skills in Python.

What’s Included:

Related Learning Paths:

About Dan Bader

Dan Bader is the owner and editor in chief of Real Python and the main developer of the realpython.com learning platform. Dan has been writing code for more than 20 years and holds a master's degree in computer science.

» More about Dan

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

Avatar image for DiscreteLoner

DiscreteLoner on June 27, 2019

Awesome! I really enjoy this video set.

Avatar image for victorariasvanegas

victorariasvanegas on June 22, 2019

Great explanation , I’m really enjoying this class.

Avatar image for sumankalyanr

sumankalyanr on June 12, 2019

Super cool explanation on method types in python.. I thoroughly enjoyed it.

← Browse All Courses