[Python-checkins] r56996 - sandbox/trunk/import_in_py/_importlib.py
brett.cannon
python-checkins at python.org
Tue Aug 14 02:32:09 CEST 2007
Author: brett.cannon
Date: Tue Aug 14 02:32:09 2007
New Revision: 56996
Modified:
sandbox/trunk/import_in_py/_importlib.py
Log:
Add a comment about why _file_types is done in __init__ instead of at class
creation time in the FileImporter subclasses.
Modified: sandbox/trunk/import_in_py/_importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/_importlib.py (original)
+++ sandbox/trunk/import_in_py/_importlib.py Tue Aug 14 02:32:09 2007
@@ -177,6 +177,7 @@
return None
+# XXX Make generic and push fs code into FileImporter?
def chaining_fs_path_hook(*path_hooks):
"""Create a path hook that sequentially asks other path hooks if they can
handle a sys.path entry, returning a chained importer for those that said
@@ -263,7 +264,6 @@
"""
self._path_entry = path_entry
- # XXX Worth pre-calculating in a metaclass?
self._suffixes = [suffix[0] for suffix in imp.get_suffixes()
if suffix[2] in self._file_types]
@@ -311,6 +311,8 @@
_loader = ExtensionFileLoader
def __init__(self, path_entry):
+ # Assigning to _file_types here instead of at the class level because
+ # imp is not imported at the time of class creation.
self._file_types = [imp.C_EXTENSION]
super(self.__class__, self).__init__(path_entry)
More information about the Python-checkins
mailing list