Currently, the codebase uses staticmethod as an alternate constructor. However, I believe that in the Python world, using classmethod is more idiomatic. staticmethod is typically used for utility functions that logically belong to the class.
Static methods in Python are similar to those found in Java or C++. Also, see classmethod() for a variant that is useful for creating alternate class constructors.
Currently, the codebase uses
staticmethod
as an alternate constructor. However, I believe that in the Python world, usingclassmethod
is more idiomatic.staticmethod
is typically used for utility functions that logically belong to the class.https://docs.python.org/3/library/functions.html#staticmethod
and some refers:
(not saying staticmethod is wrong, just want to be more idiomatic 😄😁)