Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bff8a2e7
Commit
bff8a2e7
authored
Sep 06, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Elaborate the explanation of different flavors of _* identifiers.
Fixes SF bug #520325.
parent
344ef1c8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
16 deletions
+30
-16
Doc/ref/ref2.tex
Doc/ref/ref2.tex
+30
-16
No files found.
Doc/ref/ref2.tex
View file @
bff8a2e7
...
...
@@ -320,25 +320,39 @@ In some future version of Python, the identifiers \code{as} and
\subsection
{
Reserved classes of identifiers
\label
{
id-classes
}}
Certain classes of identifiers (besides keywords) have special
meanings. These are:
meanings. These classes are identified by the patterns of leading and
trailing underscore characters:
\begin{tableiii}
{
l|l|l
}{
code
}{
Form
}{
Meaning
}{
Notes
}
\lineiii
{_
*
}{
Not imported by
\samp
{
from
\var
{
module
}
import *
}}{
(1)
}
\lineiii
{__
*
__}{
System-defined name
}{}
\lineiii
{__
*
}{
Class-private name mangling
}{}
\end{tableiii}
See sections:
\ref
{
import
}
, ``The
\keyword
{
import
}
statement'';
\ref
{
specialnames
}
, ``Special method names'';
\ref
{
atom-identifiers
}
, ``Identifiers (Names)''.
\begin{description}
Note:
\item
[\code{_*}]
Not imported by
\samp
{
from
\var
{
module
}
import *
}
. The special
identifier
\samp
{_}
is used in the interactive interpreter to store
the result of the last evaluation; it is stored in the
\module
{__
builtin
__}
module. When not in interactive mode,
\samp
{_}
has no special meaning and is not defined.
See section~
\ref
{
import
}
, ``The
\keyword
{
import
}
statement.''
\note
{
The name
\samp
{_}
is often used in conjunction with
internationalization; refer to the documentation for the
\ulink
{
\module
{
gettext
}
module
}{
../lib/module-gettext.html
}
for more
information on this convention.
}
\item
[\code{__*__}]
System-defined names. These names are defined by the interpreter
and it's implementation (including the standard library);
applications should not expect to define additional names using this
convention. The set of names of this class defined by Python may be
extended in future versions.
See section~
\ref
{
specialnames
}
, ``Special method names.''
\item
[\code{__*}]
Class-private names. Names in this category, when used within the
context of a class definition, are re-written to use a mangled for
to help avoid name clashes between ``private'' attributes of base
and derived classes.
See section~
\ref
{
atom-identifiers
}
, ``Identifiers (Names).''
\begin{description}
\item
[(1)]
The special identifier
\samp
{_}
is used in the interactive
interpreter to store the result of the last evaluation; it is stored
in the
\module
{__
builtin
__}
module. When not in interactive mode,
\samp
{_}
has no special meaning and is not defined.
\end{description}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment