Bob Belderbos: When to use classmethod, staticmethod, or instance method in Python (opens in new tab)
In a coaching call this week we discussed a create classmethod, and someone asked the obvious question: why is that here? It just forwarded its arguments to __init__. We ended up discussing the difference between instance methods, classmethods, and staticmethods, and how to tell which is which. Here's a simple decision rule. The decision rule Look at what the method actually touches: Needs the instance (self) → instance method Needs the class (cls) but not a specific instance → @classmethod N...
Read the original article