diff options
author | Fred Drake <fdrake@acm.org> | 2002-10-22 20:31:22 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-10-22 20:31:22 (GMT) |
commit | d6cf8bea0a5d0718825c7eee13bb27af2c04da99 (patch) | |
tree | a659ad0da71b670fc8021096fe6f2531c26b08c8 /Doc/lib/libfuncs.tex | |
parent | 4b2472647af97a80c4d855ffb81dbeb9e6d196fd (diff) | |
download | cpython-d6cf8bea0a5d0718825c7eee13bb27af2c04da99.zip cpython-d6cf8bea0a5d0718825c7eee13bb27af2c04da99.tar.gz cpython-d6cf8bea0a5d0718825c7eee13bb27af2c04da99.tar.bz2 |
Modify example to use string methods instead of the string module.
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r-- | Doc/lib/libfuncs.tex | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 4a0efdb..6463382 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -37,7 +37,7 @@ are always available. They are listed here in alphabetical order. a non-empty \var{fromlist} argument is given, the module named by \var{name} is returned. This is done for compatibility with the bytecode generated for the different kinds of import statement; when - using \samp{import spam.ham.eggs}, the top-level package \code{spam} + using \samp{import spam.ham.eggs}, the top-level package \module{spam} must be placed in the importing namespace, but when using \samp{from spam.ham import eggs}, the \code{spam.ham} subpackage must be used to find the \code{eggs} variable. As a workaround for this @@ -45,11 +45,9 @@ are always available. They are listed here in alphabetical order. components. For example, you could define the following helper: \begin{verbatim} -import string - def my_import(name): mod = __import__(name) - components = string.split(name, '.') + components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod |