Let\'s say you have some time-consuming work to do when a module/class is first imported. This functionality is dependent on a passed in variable. It only needs to be done
No you're not stuck with a module level function, it's just probably the best option. You could also use the builtin staticmethod
or classmethod
decorators to make it a method on someSclass
that can be called before it is instantiated.
This would make sense only if everything other than someClass
was usable without the initialization and I still think a module level function is better.