diff options
author | Guido van Rossum <guido@python.org> | 1997-03-03 16:03:27 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-03-03 16:03:27 (GMT) |
commit | 3978d75ccad1617f1b4b7055039ab2dd90b3a0d1 (patch) | |
tree | 52f0d2ecc749dddda71455dcb3989b20c76ff71b | |
parent | 38e2ec4f145d6c0f960975467b4d7399628f55f4 (diff) | |
download | cpython-3978d75ccad1617f1b4b7055039ab2dd90b3a0d1.zip cpython-3978d75ccad1617f1b4b7055039ab2dd90b3a0d1.tar.gz cpython-3978d75ccad1617f1b4b7055039ab2dd90b3a0d1.tar.bz2 |
Added intern()
-rw-r--r-- | Doc/lib/libfuncs.tex | 13 | ||||
-rw-r--r-- | Doc/libfuncs.tex | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index ddb3a91..34d50d0 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -212,6 +212,19 @@ module from which it is called). the backslash convention. \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} Convert a number to a plain integer. The argument may be a plain or long integer or a floating point number. Conversion of floating diff --git a/Doc/libfuncs.tex b/Doc/libfuncs.tex index ddb3a91..34d50d0 100644 --- a/Doc/libfuncs.tex +++ b/Doc/libfuncs.tex @@ -212,6 +212,19 @@ module from which it is called). the backslash convention. \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} Convert a number to a plain integer. The argument may be a plain or long integer or a floating point number. Conversion of floating |