Presentation of a typical code in Python

What should we expect in a programming code ?

What do we look in a Python Code ?

A brief word of introduction. Should answer to the question what I am reading here, and maybe why it is here? Read a tad more on documentation with docstrings.

A clear statement of what are the dependencies needed. This list should avoid unused dependencies, and even narrow to a specific part of a package, such as “import matplotlib.pyplot as plt”. Read more on imports.

Some dependencies are locally named with a namespace, like numpy as np, to keep a clear local link to the origin. Read more on namespaces.

Documentation of each function/method is available at the beginning, with a declaration of purpose, then the detailed list of Inputs, and output (preferably a single output). The idea is to explain why this code exists, and what exactly is the signature.

Names of objects are chosen as descriptive and short as possible. Bad naming is the actual source of most wrong usages, so take the time to read Your variable names are awful.
By the way, if your variable name is used only once, do you really need to declare a variable?

… this explicit naming goes for functions names as well. The developer’s idea can change during the implementation, make sure your names follow your idea.

The code use multiline statements to avoid lateral scrolling. This is of great help when merging codes (3 columns of the same code), or showing code snippets on screen or paper. You can read more here.

The documentation is not always proportional to the number of the statements. Here two statements still deserve an extensive description of the method, because the signature need explanations..

Reminding the credits and Licence are good practices, as long as you are ready to maintain it up-to-date. However, this will never replace a good git blame and a fully fledged LICENSE file.