3 ms·
Is Python significantly better in this regard? I don't think so, especially with the differentiation between modules which are directories with an __init__.py a
by morelisp 4y ago
Is Python significantly better in this regard? I don't think so, especially with the differentiation between modules which are directories with an __init__.py and modules which are files you import directly but if not in the same directory also still need an __init__.py which has tripped up probably 80% of the people I try to teach Python to.
In Go you can at least get pretty far with a totally flat namespace and there's nothing wrong with that, up to at least 50kloc or so. That's less true in any language where files become a unit of modularization.
- Scarblac 4y ago> modules which are files you import directly but if not in the same directory also still need an __init__.py which has tripped up probably 80% of the people I try to teach Python to. Not necessary anymore since Python 3.3 (released in 2012).
- kccqzy 4y agoWith python you can also go pretty far without __init__.py IMO. Just put everything in a single directory.
- morelisp 4y agoBeginners trying this are still liable to make import cycles, which... sort of work? Depending on what you do with them? I feel like Go and Java have much better (and different) answers here; I wonder what a Python equivalent of the Java style would look like.
- DandyDev 4y agoDirectories with an __init__.py are not modules, they are packages. Modules are .py files