---
title: "Explain the difference between @staticmethod, @classmethod, and regular instance methods."  
description: "Explain the difference between @staticmethod, @classmethod, and regular instance methods."  
author: "Anubhav Sharma"  
published: 2025-04-21  
updated: 2025-06-03  
canonical: https://www.mindstick.com/forum/161504/explain-the-difference-between-staticmethod-classmethod-and-regular-instance-methods  
category: "python"  
tags: ["python-3.4", "python"]  
reading_time: 2 minutes  

---

# Explain the difference between @staticmethod, @classmethod, and regular instance methods.

[Explain the difference](https://www.mindstick.com/forum/156125/can-you-explain-the-difference-between-organic-and-paid-results) between `@staticmethod`, `@classmethod`, and [regular](https://www.mindstick.com/forum/220/problem-in-regular-expression-in-javascript) [instance methods](https://www.mindstick.com/forum/161894/what-s-the-difference-between-staticmethod-classmethod-and-instance-methods).

## Replies

### Reply by ICSM Computer

In Python classes, `@staticmethod`, `@classmethod`, and regular [instance](https://www.mindstick.com/forum/155658/testing-connection-to-cloud-sql-instance-with-a-mysql-client-from-vm-instance) methods differ in **how they receive and use their first argument** and **how they relate to the class and its instances**.

### 1. Regular Instance Methods

- **First parameter:** `self` (the instance itself)
- Can access and modify **instance attributes** and **other instance methods**.
- Called on an **instance** of the class.

```python
class MyClass:
    def instance_method(self):
        print(f"Called instance_method of {self}")

obj = MyClass()
obj.instance_method()  # Works, 'self' refers to 'obj'
```

### 2. @staticmethod

- Does **NOT** take `self` or `cls` as the first argument.
- Behaves like a **regular function inside the class namespace**.
- Cannot access instance (`self`) or class (`cls`) data.
- Called on the class or instance, but no reference to either is passed automatically.

```python
class MyClass:
    @staticmethod
    def static_method():
        print("Called static_method")

MyClass.static_method()  # Works
obj = MyClass()
obj.static_method()      # Also works
```

### 3. @classmethod

- First parameter is `cls` (the class itself).
- Can access and modify **class state** that applies across all instances.
- Called on the class or instance, but receives the class as the first argument.

```python
class MyClass:
    class_var = 0

    @classmethod
    def class_method(cls):
        print(f"Called class_method of {cls}")
        print(f"Class variable: {cls.class_var}")

MyClass.class_method()  # Works
obj = MyClass()
obj.class_method()      # Also works, cls is MyClass
```

### Summary Table

| Method Type | First Argument | Can Access Instance Data? | Can Access Class Data? | How Called |
| --- | --- | --- | --- | --- |
| Instance Method | `self` | Yes | Yes | `obj.method()` |
| Static Method | None | No | No | `Class.method()` or `obj.method()` |
| Class Method | `cls` | No | Yes | `Class.method()` or `obj.method()` |


---

Original Source: https://www.mindstick.com/forum/161504/explain-the-difference-between-staticmethod-classmethod-and-regular-instance-methods

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
