Leading underscore convention
The leading underscore convention prefixes an identifier with an underscore to signal intended internal or non-public use without enforcing access restrictions.
Web Components in Action
- How it is used
- Signals which Web Component properties and methods consumers should treat as internal rather than part of the public API.
- How deep it goes
- Distinguishes convention-based signaling from actual privacy and demonstrates internal state behind setters.
- Examples
- Uses _addItemToUI, _searchTerm, _apiKey, public setters, and redraw behavior as concrete examples.
- What you can do after
- Apply it by naming internal component state and methods with underscores while exposing deliberate public properties.
Read how Web Components in Action explains leading underscore convention →
Python How-To
- How it is used
- Signals that class methods or attributes are intended for internal use and reduces irrelevant IDE autocomplete suggestions.
- How deep it goes
- Defines the naming convention and its autocomplete effects, while stopping short of enforcing access restrictions.
- Examples
- Uses _format_note, protected class members, and a challenge to rename applicable methods as nonpublic.
- What you can do after
- Apply it via Python naming conventions to communicate which methods and attributes users should avoid calling directly.
Read how Python How-To explains leading underscore convention →
Related concepts
- private memberconfigures · A private member is a program element whose direct access is restricted to its defining class, module, file, or other language-defined scope.
- protected memberconfigures · A protected member is a class attribute or method accessible within its defining class and, subject to language rules, within subclasses or other related contexts.
- tuple unpackinguses · Tuple unpacking is assigning the elements of an iterable to multiple corresponding targets in a single operation.
- authorizationimplemented by · Authorization is the determination and enforcement of rules governing which subjects may access resources or perform operations.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

