
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How Many Python Classes Should I Put in One File?
Python code is organized in files called "modules" and groups of related modules called “packages".
A module is a distinct unit that may have one or more closely-related classes. Modules need to be imported before they are read, used, maintained and extended if needed. So a module is a unit or reuse.
The rule is this: a module is the unit of reuse. Everything in Python libraries and other Python applications is either a module or a package of modules.
There is no limit on how many classes one can put in a file or a module. It all depends on how big or small the project is and how long or short the classes are. It is a matter of convenience and efficient and productive organization.
Advertisements