[Python-checkins] CVS: python/dist/src/Doc/ref ref6.tex,1.37,1.37.2.1

Fred L. Drake fdrake@users.sourceforge.net
2001年10月24日 12:52:16 -0700


Update of /cvsroot/python/python/dist/src/Doc/ref
In directory usw-pr-cvs1:/tmp/cvs-serv6583/ref
Modified Files:
 Tag: release21-maint
	ref6.tex 
Log Message:
When describing "import *", add a level of indirection between "*" and the
set of names imported (the "public names"), adding a definition of "public
names" that describes the use of __all__.
This closes SF bug #473986.
Flesh out the vague reference to __import__().
Index: ref6.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v
retrieving revision 1.37
retrieving revision 1.37.2.1
diff -C2 -d -r1.37 -r1.37.2.1
*** ref6.tex	2001年04月13日 15:55:25	1.37
--- ref6.tex	2001年10月24日 19:52:14	1.37.2.1
***************
*** 567,575 ****
 supplied by specifying "\keyword{as} localname". If a name is not found,
 \exception{ImportError} is raised. If the list of identifiers is replaced
! by a star (\samp{*}), all names defined in the module are bound, except
! those beginning with an underscore (\character{_}).
 \indexii{name}{binding}
 \exindex{ImportError}
 
 Names bound by \keyword{import} statements may not occur in
 \keyword{global} statements in the same scope.
--- 567,584 ----
 supplied by specifying "\keyword{as} localname". If a name is not found,
 \exception{ImportError} is raised. If the list of identifiers is replaced
! by a star (\character{*}), all public names defined in the module are
! bound in the local namespace of the \keyword{import} statement..
 \indexii{name}{binding}
 \exindex{ImportError}
 
+ The \emph{public names} defined by a module are determined by checking
+ the module's namespace for a variable named \code{__all__}; if
+ defined, it must be a sequence of strings which are names defined or
+ imported by that module. The names given in \code{__all__} are all
+ considered public and are required to exist. If \code{__all__} is not
+ defined, the set of public names includes all names found in the
+ module's namespace which do not begin with an underscore character
+ (\character{_}).
+ 
 Names bound by \keyword{import} statements may not occur in
 \keyword{global} statements in the same scope.
***************
*** 592,596 ****
 about how the module search works from inside a package.]
 
! [XXX Also should mention __import__().]
 \bifuncindex{__import__}
 
--- 601,610 ----
 about how the module search works from inside a package.]
 
! The built-in function \function{__import__()} is provided to support
! applications that determine which modules need to be loaded
! dynamically; refer to \ulink{Built-in
! Functions}{../lib/built-in-funcs.html} in the
! \citetitle[../lib/lib.html]{Python Library Reference} for additional
! information.
 \bifuncindex{__import__}
 

AltStyle によって変換されたページ (->オリジナル) /