Documentation for @staticmethod decorator
I can't find any documentation for the
@staticmethod
decorator. Is there any writeup for why, when, and how to use it? I see it scattered throughout the official docs, but can't quite piece together how it works.3 Replies
Perfect, thanks!
Hello, here is a nice explanation: https://docs.modular.com/mojo/programming-manual.html#types-that-cannot-be-instantiated (depreciated programming manual)
It is quite nice to act as a namespace, in addition, traits can require staticmethod: https://docs.modular.com/mojo/manual/traits.html#traits-can-require-static-methods
In the new doc there are mention of it there: https://docs.modular.com/mojo/manual/lifecycle/life.html , but i don't see it mentioned in the struct page