No, there is no agreement for organizing functions and classes. However, there are some basic guidelines that will make your source stream better and more understandable to readers:
- Document. No matter what you do, make sure that the use (and in some cases the implementation) of classes and functions is described in plain English)
- Group everything that is the same. Two functions that perform similar functions? Connect them.
- Use common sense. If the class extends another, the base class must be the first. If the function accepts an instance of the class that you defined, make sure that the class definition is defined first.
, , , Python. , Python.