Real Python Tutorials

Single and Double Underscores in Python Names
NEW

Single and Double Underscore Naming Conventions in Python

In this video course, 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.

Feb 25, 2025 intermediate best-practices python