Python 3 Naming Conventions Recommendation

In this blog post, I will show you a few naming conventions recommendations for Python will help you keep your code in order.

Python has made a few recommendations on how to name variables and constant.

Variables

When it comes to naming variables, Python recommends you use the naming convention below (no upper letters):

my_value = "ntweekly"

The above variable name uses lowercases and underscore.

Static Values (Constants)

When you name values that are not meant to be changed, you should use capital letters only as shown below:

STATIC_VALUE = 8

Avoid using

The last recommendation you should follow is simple but powerful, avoid by all means using the following:

Lower case I

Upper case O

Please don’t use this two-letter as a single variable name as they can be easily mistaken for 1 and 0.


Posted

in

by