Real Python Tutorials

Single and Double Underscores in Python Names
NEW

Single and Double Underscores in Python Names

In this tutorial, you'll learn a few Python naming conventions involving single and double underscores (_). You'll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.

Nov 29, 2023 best-practices intermediate python