[Python-checkins] r68919 - in python/branches/py3k: Doc/library/importlib.rst Lib/importlib/NOTES Lib/importlib/_bootstrap.py
brett.cannon
python-checkins at python.org
Sun Jan 25 05:56:31 CET 2009
Author: brett.cannon
Date: Sun Jan 25 05:56:30 2009
New Revision: 68919
Log:
Document both importlib.machinery.BuiltinImporter and FrozenImporter.
Modified:
python/branches/py3k/Doc/library/importlib.rst
python/branches/py3k/Lib/importlib/NOTES
python/branches/py3k/Lib/importlib/_bootstrap.py
Modified: python/branches/py3k/Doc/library/importlib.rst
==============================================================================
--- python/branches/py3k/Doc/library/importlib.rst (original)
+++ python/branches/py3k/Doc/library/importlib.rst Sun Jan 25 05:56:30 2009
@@ -61,7 +61,7 @@
Functions
---------
-.. function:: __import__(name, globals={}, locals={}, fromlist=\[\], level=0)
+.. function:: __import__(name, globals={}, locals={}, fromlist=list(), level=0)
An implementation of the built-in :func:`__import__` function. See the
built-in function's documentation for usage instructions.
@@ -76,3 +76,49 @@
package name (e.g. ``import_module('..mod', 'pkg.subpkg')`` will import
``pkg.mod``). The specified module will be inserted into
:data:`sys.modules` and returned.
+
+
+:mod:`importlib.machinery` -- Importers and path hooks
+------------------------------------------------------
+
+.. module:: importlib.machinery
+ :synopsis: Importers and path hooks
+
+This module contains the various objects that help :keyword:`import`
+find and load modules.
+
+.. class:: BuiltinImporter
+
+ :term:`Importer` for built-in modules. All known built-in modules are
+ listed in :data:`sys.builtin_module_names`.
+
+ Only class methods are defined by this class to alleviate the need for
+ instantiation.
+
+ .. method:: find_module(fullname, path=None)
+
+ Class method that allows this class to be a :term:`finder` for built-in
+ modules.
+
+ .. method:: load_module(fullname)
+
+ Class method that allows this class to be a :term:`loader` for built-in
+ modules.
+
+
+.. class:: FrozenImporter
+
+ :term:`Importer` for frozen modules.
+
+ Only class methods are defined by this class to alleviate the need for
+ instantiation.
+
+ .. method:: find_module(fullname, path=None)
+
+ Class method that allows this class to be a :term:`finder` for frozen
+ modules.
+
+ .. method:: load_module(fullname)
+
+ Class method that allows this class to be a :term:`loader` for frozen
+ modules.
Modified: python/branches/py3k/Lib/importlib/NOTES
==============================================================================
--- python/branches/py3k/Lib/importlib/NOTES (original)
+++ python/branches/py3k/Lib/importlib/NOTES Sun Jan 25 05:56:30 2009
@@ -1,12 +1,6 @@
to do
/////
-* Document:
-
- + The terms "importer", "finder", and "loader".
- + machinery.BuiltinImporter.
- + machinery.FrozenImporter.
-
* Expose resolve_name().
* Backport to Python 2.7.
Modified: python/branches/py3k/Lib/importlib/_bootstrap.py
==============================================================================
--- python/branches/py3k/Lib/importlib/_bootstrap.py (original)
+++ python/branches/py3k/Lib/importlib/_bootstrap.py Sun Jan 25 05:56:30 2009
@@ -110,8 +110,8 @@
return None
return cls if imp.is_builtin(fullname) else None
- @staticmethod
- def load_module(fullname):
+ @classmethod
+ def load_module(cls, fullname):
"""Load a built-in module."""
if fullname not in sys.builtin_module_names:
raise ImportError("{0} is not a built-in module".format(fullname))
More information about the Python-checkins
mailing list