Naming conventions
Naming conventions in Python are recommendations of how various elements in a Python program need to be named to ensure ease of navigation and consistency. Navigating through code, connecting the dots, and understanding the flow are all made easier by following consistent naming conventions throughout the code. This is another important standard that helps in developing maintainable applications.
In this section, we will see how you should ideally name classes, variables, functions, and methods.
Class names
While creating a new class, it is recommended to start the class name with an uppercase letter followed by lowercase letters and capitalize whenever there are words that need differentiation within the class name.
For example, let’s define a class for the billing counter.
The following style is not the preferred naming convention:
class billing_counter:
def __init__(self, productname, unitprice, quantity...