[Python-checkins] r53802 - sandbox/trunk/import_in_py/importlib.py

brett.cannon python-checkins at python.org
Fri Feb 16 20:52:34 CET 2007


Author: brett.cannon
Date: Fri Feb 16 20:52:33 2007
New Revision: 53802

Modified:
   sandbox/trunk/import_in_py/importlib.py
Log:
Add a comment about whether using __path__ from globals is worth considering.


Modified: sandbox/trunk/import_in_py/importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/importlib.py	(original)
+++ sandbox/trunk/import_in_py/importlib.py	Fri Feb 16 20:52:33 2007
@@ -762,6 +762,13 @@
             current_name = ".".join(current_name_parts)
             if parent_module:
                 try:
+                    # XXX Better to use __path__ as found in 'globals' argument
+                    # in __call__?  Possibly different if module in sys.modules
+                    # resolves to a different one from where the import call
+                    # was made.  Not sure if this worth worrying about, though,
+                    # since relative imports could easily negate use of
+                    # __path__ and sys.modules is totally reasonable to
+                    # consider the canonical modules.
                     path_list = parent_module.__path__
                 except AttributeError:
                     pass
@@ -807,8 +814,8 @@
         
     def _return_module(self, absolute_name, relative_name, fromlist):
         """Return the proper module based on what module was requested (and its
-        absolute module name), who is
-        requesting it, and whether any speicific attributes were specified.
+        absolute module name), who is requesting it, and whether any speicific
+        attributes were specified.
         
         The semantics of this method revolve around 'fromlist'.  When it is
         empty, the module up to the first dot is to be returned.  When the


More information about the Python-checkins mailing list