On Fri, Sep 11, 2020 at 4:00 PM The Nomadic Coder
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). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...