Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is the problem here not simply that Python does not have a convenient way to namespace functions except a class declaration? The `module` keyword in e.g., Julia or Rust seems like what's desired to avoid this phenomenon of "a class which is just a bundle of static methods".


Python uses modules to namespace functions.


Yes but modules are very unergonomic for some of the use cases listed in the article, with their dependence on `__init__.py` and imports being wonky.


You don't have to use __init__.py -- you can just create any python file and it will be a module.

And I'm not sure why you think that's unergonomic. If you want a bunch of functions to share the same namespace, just put them in the same file. The name of the file becomes your module name.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: