3 ms·
Both of those work. There is also `module_function` for when you don’t want to write `self`.
by breckenedge 3y ago
Both of those work. There is also `module_function` for when you don’t want to write `self`.
- cout 3y agomodule_function is different in that it makes the method both a class method (i.e. an instance method on the singleton class) and a private instance method (so you can call the method with implicit self). Once upon a time a used this a lot because it felt conceptually similar to a C++ static member function, but I rarely use it any more.