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

Thomas Wouters python-dev@python.org
Thu, 17 Aug 2000 15:55:02 -0700


Update of /cvsroot/python/python/dist/src/Doc/ref
In directory slayer.i.sourceforge.net:/tmp/cvs-serv24798/Doc/ref

Modified Files:
	ref6.tex 
Log Message:

Apply SF patch #101135, adding 'import module as m' and 'from module import
name as n'. By doing some twists and turns, "as" is not a reserved word.

There is a slight change in semantics for 'from module import name' (it will
now honour the 'global' keyword) but only in cases that are explicitly
undocumented.



Index: ref6.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** ref6.tex	2000/07/16 19:05:38	1.27
--- ref6.tex	2000/08/17 22:54:59	1.28
***************
*** 444,449 ****
  
  \begin{verbatim}
! import_stmt:    "import" module ("," module)* 
!               | "from" module "import" identifier ("," identifier)*
                | "from" module "import" "*" 
  module:         (identifier ".")* identifier
--- 444,450 ----
  
  \begin{verbatim}
! import_stmt:    "import" module ["as" name] ("," module ["as" name] )* 
!               | "from" module "import" identifier ["as" name]
!                 ("," identifier ["as" name] )*
                | "from" module "import" "*" 
  module:         (identifier ".")* identifier
***************
*** 497,507 ****
  The first form of \keyword{import} statement binds the module name in the
  local namespace to the module object, and then goes on to import the
! next identifier, if any.  The \keyword{from} form does not bind the
! module name: it goes through the list of identifiers, looks each one
! of them up in the module found in step (1), and binds the name in the
! local namespace to the object thus found.  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}
--- 498,511 ----
  The first form of \keyword{import} statement binds the module name in the
  local namespace to the module object, and then goes on to import the
! next identifier, if any.  If the module name is followed by \keyword{as},
! the name following \keyword{as} is used as the local name for the module. 
! The \keyword{from} form does not bind the module name: it goes through the
! list of identifiers, looks each one of them up in the module found in step
! (1), and binds the name in the local namespace to the object thus found. 
! Like with the first form of \keyword{import}, an alternate local name can be
! 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}