Code organization in modules

The PEP-8 structure and sequence guidelines will be followed, with a module level doc string, imports from __future__, various dunder-names (an __all__ list to support from [module] import [member] use of the module's members, and some standard __author__, __copyright__ and __status__ metadata about the module), then imports from standard libraries, then third-party libraries, and finally internal libraries.

After that, code will be organized and grouped by member types, in this order, with each element in alphabetical order (unless there are functional reasons why that order isn't viable, such as classes depending on or inheriting from other classes that haven't been defined yet if they are in strict order)

Get Hands-On Software Engineering with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.