Sometime we call coding style as convention for naming identifiers.
Naming conventions make programs more understandable by making them easier to read. They can also give information about the function of the identifier-for example, whether it's a constant, package, or class-which can be helpful in understanding the code.

  • Conventions of Coding python are as follows

    here are the most important points extracted for you:

    • Use 4-space indentation, and no tabs.

    • Wrap lines so that they donā??t exceed 79 characters.

    • Use blank lines to separate functions and classes, and larger blocks of code inside functions.

    • Always use comments for each statement if possible.

    • Always Use docstrings.

    • Use spaces around operators and after commas, but not directly inside bracketing constructs: a = f(1, 2) + g(3, 4).

    • Name your classes and functions consistently; the convention is to use CamelCase for classes and lower_case_with_underscores for functions and methods. Always use self as the name for the first method argument .

What next?

The next topic is Python Programming Tutorial

Share this page