serhii.net

In the middle of the desert you can say anything you want

28 Oct 2021

211028-1110 Python staticmethod vs classmethod

A @classmethod gets the class as first parameter, nice for constructors/factories etc. A @staticmethod doesn’t know anything about the class at all, and the only use it has is to put functions that logically belong to the class inside the class. 1

Additionally,

Nel mezzo del deserto posso dire tutto quello che voglio.