Single and Double Underscore Naming Conventions in Python - Real Python
Briefly

The article discusses Python's important naming conventions that utilize underscores to differentiate between public and non-public names in APIs. It emphasizes that adhering to these conventions creates Pythonic and consistent code, facilitating collaboration among developers. The course outlined involves learning how to use underscores effectively, including single leading underscores for indicating non-public attributes and double leading underscores for name mangling in classes. It also touches upon other common uses of underscores in Python naming, making the content beneficial for those aiming to write clean and maintainable code.
Python naming conventions, particularly those involving underscores, help distinguish between public and private API elements, enhancing code clarity and maintainability.
Understanding how to utilize single and double underscores is crucial for defining public and non-public attributes in your classes.
By following underscore conventions, developers can write more Pythonic code, making it easier for others to understand and collaborate on the project.
Effective use of naming conventions in Python not only prevents name clashes but also sets the groundwork for safe and clear class hierarchies.
Read at Realpython
[
|
]