Search code examples
pythonclassstatic-methods

Is there any advantage in using a Python class?


I have a Python class full of static methods. What are the advantages and disadvantages of packaging these in a class rather than raw functions?


Solution

  • There are none. This is what modules are for: grouping related functions. Using a class full of static methods makes me cringe from Javaitis. The only time I would use a static function is if the function is an integral part of the class. (In fact, I'd probably want to use a class method anyway.)