On Fri, Sep 11, 2020 at 4:00 PM The Nomadic Coder <atemysemico...@gmail.com> 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). -- --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-change-the-world/>
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/N5ZBMAUTUHDAQI232PM2MLDB47OJRGQE/ Code of Conduct: http://python.org/psf/codeofconduct/