How it works...

Naming conventions for Python code modules are a great help in keeping us efficient and helping us remember our original design. When we need to debug and fix a defect or add a new functionality, they are the first resources to look at.

Incrementing module names by numbers is not very meaningful and eventually wastes development time.

On the other hand, naming Python variables is more of a free form. Python infers types, so we do not have to specify that a variable will be of type <list> (it might not be, or later in the code, it might become a different type).

A good idea for naming variables is to make them descriptive and it is also a good idea not to abbreviate too much.

If we wish to point out that a certain variable is designed to be of the <list> type, then it is much more intuitive to use the full word list instead of lst.

It is similar for number instead of num.

While it is a good idea to have very descriptive names for variables, sometimes that can get too long. In Apple's Objective-C language, some variable and function names are extreme: thisIsAMethodThatDoesThisAndThatAndAlsoThatIfYouPassInNIntegers:1:2:3

Use common sense when naming variables, methods, and functions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.55.18