On Fri, Sep 11, 2020 at 4:00 PM The Nomadic Coder firstname.lastname@example.org wrote:
This question is to further my understanding of the internals. It seems to me that a classmethod can do everything a staticmethod can, and additionally is not limited by inheritance.
Why does python have them as two different constructs?
The answer is actually somewhat embarrassing. IIRC I had heard of this concept in another language (C++? Smalltalk?) and it sounded useful, so I added staticmethod. Then after the release and some actual use I realized that it was actually useful to have access to the class from inside the method (in case it's called for a subclass). So I also added classmethod. But since staticmethod was already out of the bag, I kept it around, and it's found its uses (as you can see from other replies).