M
Miranda Evans
Seeking reference material (a url, a book, an article) that offers
advice and guidelines for organizing classes within files.
For example, assume two classes:
1) SuperABC - a superclass
2) InheritorABC - a class that inherits from SuperABC
I can think of two ways of organizing these classes within files:
1) One class per file:
- the file SuperABCClass.py contains the source code for the class
SuperABC
- The file InheritorABCClass.py contains the source code for the class
InheritorABC
- InheritorABC imports SuperABCClass
2) Grouping classes into one .py file:
- the file GroupedABCClasses.py contains the source code for the class
SuperABC and the source code for the class InheritorABC
Seeking reference material that might answer the questions:
When does it make sense to employ the one-class-per-file technique?
When does it make sense to group classes into one .py file?
What are the tradeoffs of using one-class-per-file technique vs the
grouping classes into a single file technique?
advice and guidelines for organizing classes within files.
For example, assume two classes:
1) SuperABC - a superclass
2) InheritorABC - a class that inherits from SuperABC
I can think of two ways of organizing these classes within files:
1) One class per file:
- the file SuperABCClass.py contains the source code for the class
SuperABC
- The file InheritorABCClass.py contains the source code for the class
InheritorABC
- InheritorABC imports SuperABCClass
2) Grouping classes into one .py file:
- the file GroupedABCClasses.py contains the source code for the class
SuperABC and the source code for the class InheritorABC
Seeking reference material that might answer the questions:
When does it make sense to employ the one-class-per-file technique?
When does it make sense to group classes into one .py file?
What are the tradeoffs of using one-class-per-file technique vs the
grouping classes into a single file technique?