[Python-checkins] python/nondist/peps pep-0302.txt,1.8,1.9

jvr@users.sourceforge.net jvr@users.sourceforge.net
Sat, 28 Dec 2002 02:16:10 -0800


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1:/tmp/cvs-serv6212

Modified Files:
	pep-0302.txt 
Log Message:
- removed the importer-on-sys.path feature (an update patch will be posted
  later)
- renamed imp.find_module2() to imp.get_loader() as suggested by Guido.


Index: pep-0302.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0302.txt,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** pep-0302.txt	26 Dec 2002 19:03:22 -0000	1.8
--- pep-0302.txt	28 Dec 2002 10:16:07 -0000	1.9
***************
*** 170,180 ****
      dispatcher.)
  
-     As a bonus, the idea from the second paragraph of this section was
-     implemented after all: a sys.path item may *be* an importer object.
-     This use is discouraged for general purpose code, but it's very
-     convenient, for experimentation as well as for projects of which
-     it's known that no component wrongly assumes that sys.path items are
-     strings.
- 
  
  Specification part 1: The Importer Protocol
--- 170,173 ----
***************
*** 302,313 ****
      Path hooks are called as part of sys.path (or package.__path__)
      processing, at the point where their associated path item is
!     encountered.  A path hook can be registered in either of two ways:
! 
!     - By simply including an importer object directly on the path.
!       This approach is discouraged for general purpose hooks, as
!       existing code may not be expecting non-strings to exist on
!       sys.path.
! 
!     - By registering an importer factory in sys.path_hooks.
  
      sys.path_hooks is a list of callables, which will be checked in
--- 295,300 ----
      Path hooks are called as part of sys.path (or package.__path__)
      processing, at the point where their associated path item is
!     encountered.  A path hook is registered by adding an importer
!     factory to sys.path_hooks.
  
      sys.path_hooks is a list of callables, which will be checked in
***************
*** 346,356 ****
      sys.path when importing submodules of the package.  The rules for
      sys.path therefore also apply to pkg.__path__.  So sys.path_hooks is
!     also consulted when pkg.__path__ is traversed and importer objects
!     as path items are also allowed (yet, are discouraged for the same
!     reasons as they are discouraged on sys.path, at least for general
!     purpose code).  Meta importers don't necessarily use sys.path at all
!     to do their work and may therefore ignore the value of pkg.__path__.
!     In this case it is still advised to set it to list, which can be
!     empty.
  
  
--- 333,340 ----
      sys.path when importing submodules of the package.  The rules for
      sys.path therefore also apply to pkg.__path__.  So sys.path_hooks is
!     also consulted when pkg.__path__ is traversed.  Meta importers don't
!     necessarily use sys.path at all to do their work and may therefore
!     ignore the value of pkg.__path__.  In this case it is still advised
!     to set it to list, which can be empty.
  
  
***************
*** 431,438 ****
      basic *unhooked* built-in import mechanism".  They simply won't
      invoke any import hooks.  A new imp module function is proposed (but
!     not yet implemented) under the name "find_module2", which is used as
      in the following pattern:
  
!         loader = imp.find_module2(fullname, path)
          if loader is not None:
              loader.load_module(fullname)
--- 415,422 ----
      basic *unhooked* built-in import mechanism".  They simply won't
      invoke any import hooks.  A new imp module function is proposed (but
!     not yet implemented) under the name "get_loader", which is used as
      in the following pattern:
  
!         loader = imp.get_loader(fullname, path)
          if loader is not None:
              loader.load_module(fullname)
***************
*** 451,456 ****
  
      Existing __import__ hooks will not invoke new-style hooks by magic,
!     unless they call the original __import__ function as a fallback. For
!     example, ihooks.py, iu.py and imputil.py are in this sense not
      forward compatible with this PEP.
  
--- 435,440 ----
  
      Existing __import__ hooks will not invoke new-style hooks by magic,
!     unless they call the original __import__ function as a fallback.
!     For example, ihooks.py, iu.py and imputil.py are in this sense not
      forward compatible with this PEP.
  
***************
*** 561,565 ****
      pkg.__path__ variable may be needed at this point.  It may either
      come from the actual parent module or be supplied by
!     imp.find_module() or the proposed imp.find_module2() function.
  
      [8] Quixote, a framework for developing Web applications
--- 545,549 ----
      pkg.__path__ variable may be needed at this point.  It may either
      come from the actual parent module or be supplied by
!     imp.find_module() or the proposed imp.get_loader() function.
  
      [8] Quixote, a framework for developing Web applications