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
3978d75c
Commit
3978d75c
authored
Mar 03, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added intern()
parent
38e2ec4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
Doc/lib/libfuncs.tex
Doc/lib/libfuncs.tex
+13
-0
Doc/libfuncs.tex
Doc/libfuncs.tex
+13
-0
No files found.
Doc/lib/libfuncs.tex
View file @
3978d75c
...
@@ -212,6 +212,19 @@ module from which it is called).
...
@@ -212,6 +212,19 @@ module from which it is called).
the backslash convention.
the backslash convention.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
intern
}{
string
}
Enter
\var
{
string
}
in the table of ``interned'' strings and return
the interned string -- which is
\var
{
string
}
itself or a copy.
Interning strings is useful to gain a little performance on
dictionary lookup -- if the keys in a dictionary are interned, and
the lookup key is interned, the key comparisons (after hashing) can
be done by a pointer compare instead of a string compare. Normally,
the names used in Python programs are automatically interned, and
the dictionaries used to hold module, class or instance attributes
have interned keys. Interned strings are immortal (i.e. never get
garbage collected).
\end{funcdesc}
\begin{funcdesc}
{
int
}{
x
}
\begin{funcdesc}
{
int
}{
x
}
Convert a number to a plain integer. The argument may be a plain or
Convert a number to a plain integer. The argument may be a plain or
long integer or a floating point number. Conversion of floating
long integer or a floating point number. Conversion of floating
...
...
Doc/libfuncs.tex
View file @
3978d75c
...
@@ -212,6 +212,19 @@ module from which it is called).
...
@@ -212,6 +212,19 @@ module from which it is called).
the backslash convention.
the backslash convention.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
intern
}{
string
}
Enter
\var
{
string
}
in the table of ``interned'' strings and return
the interned string -- which is
\var
{
string
}
itself or a copy.
Interning strings is useful to gain a little performance on
dictionary lookup -- if the keys in a dictionary are interned, and
the lookup key is interned, the key comparisons (after hashing) can
be done by a pointer compare instead of a string compare. Normally,
the names used in Python programs are automatically interned, and
the dictionaries used to hold module, class or instance attributes
have interned keys. Interned strings are immortal (i.e. never get
garbage collected).
\end{funcdesc}
\begin{funcdesc}
{
int
}{
x
}
\begin{funcdesc}
{
int
}{
x
}
Convert a number to a plain integer. The argument may be a plain or
Convert a number to a plain integer. The argument may be a plain or
long integer or a floating point number. Conversion of floating
long integer or a floating point number. Conversion of floating
...
...
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