I'm trying to structure my app in Python. Coming back from C#/Java background, I like the approach of one class per file. I'd like my project tree to look like this:
[Service]
[Database]
DbClass1.py
DbClass2.py
[Model]
DbModel1.py
DbModel2.py
TheService.py
[ServiceTests]
[Database]
DbClass1Tests.py
DbClass2Tests.py
[Model]
DbModel1Tests.py
DbModel2Tests.py
TheServiceTests.py
- Is the one class per file approach OK in Python?
Is it possible to create packages/modules in such a way so that packages work like Java's packages or .NET's namespaces, i.e. in DbModel1Tests.py:
import Service.Model def test(): m = DbModel1()