10000 gh-120452: improve documentation about private name mangling by picnixz · Pull Request #120451 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-120452: improve documentation about private name mangling #120451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jul 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address feedback review
  • Loading branch information
picnixz committed Jun 15, 2024
commit 035ed682aa3a853c69be28c239950f92bf8bc742
12 changes: 6 additions & 6 deletions Doc/reference/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ implementation-defined truncation may happen.
The transformation is independent of the syntactical context in which the
identifier is used but only the following private identifiers are mangled:

- Any name used as the name of a variable that is assigned or read or any
name of an attribute being accessed.

The ``__name__`` attribute of nested functions, classes, and type aliases
is however not mangled.

- The name of imported modules, e.g., ``__spam`` in ``import __spam``.
If the module is part of a package (i.e., its name contains a dot),
the name is *not* mangled, e.g., the ``__foo`` in ``import __foo.bar``
is not mangled.

- The name of an imported member, e.g., ``__f`` in ``from spam import __f``.

- Any name used as the name of a variable that is assigned or read or any
name of an attribute being accessed.

The ``__name__`` attribute of nested functions, classes, and type aliases
is however not mangled.

The transformation rule is defined as follows:

- If the class name consists only of underscores, the transformation is the
Expand Down
Loading
0