Simple tips for predictable code

RomanMizulin - Apr 22 - - Dev Community

Functional programming is a complex topic in Python, but here are simple rules, that anyone can stick to and write more reliable and readable functions from my 4y+ experience:

  1. Write type annotations.
  2. Do not mutate input data.
  3. Use less classes.

simple example

That's it!

P.S. Yes, there are standard and 3rd party libraries which can enhance productivity, but see tips above as a general rule and common ground.

. . . . . .
Terabox Video Player