Showing content from http://mail.python.org/pipermail/python-dev/attachments/20060807/c1a25e6d/attachment.obj below:
_`Python 2.4.3 (#2, Apr 27 2006, 14:43:58)`:: [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> m=__import__('fakemod.a/b') >>> m.__file__ 'fakemod/__init__.py' >>> import sys; print '\n'.join([k for k in sys.modules.keys() if k.find('fakemod') > -1]) fakemod fakemod.a/b >>> _`Python 2.5b3 (trunk:51136, Aug 7 2006, 09:56:56)`:: [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> m=__import__('fakemod.a/b') >>> m.__file__ 'fakemod/__init__.py' >>> import sys; print '\n'.join([k for k in sys.modules.keys() if k.find('fakemod') > -1]) fakemod fakemod.a/b >>> _`Python 2.4.3 (#2, Apr 27 2006, 14:43:58)`:: [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from fakemod import urlpathimport >>> urlpathimport.install() >>> m=__import__('fakemod.a/b') *** fakemod.a/b *** >>> _`Python 2.5b3 (trunk:51136, Aug 7 2006, 09:56:56)`:: [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from fakemod import urlpathimport >>> urlpathimport.install() >>> m=__import__('fakemod.a/b') *** fakemod.a/b *** Traceback (most recent call last): File " ", line 1, in ImportError: No module named a/b >>> _`[PATCH]Python 2.5b3 (trunk:51136M, Aug 7 2006, 10:48:15)`:: [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from fakemod import urlpathimport >>> urlpathimport.install() >>> m=__import__('fakemod.a/b') *** fakemod.a/b *** >>> _`find ./fakemod`:: ./fakemod ./fakemod/__init__.py ./fakemod/a ./fakemod/a/__init__.py ./fakemod/a/b ./fakemod/a/b/__init__.py ./fakemod/a/c ./fakemod/urlpathimport.py _`cat ./fakemod/urlpathimport.py`:: import sys from sys import path_hooks, path_importer_cache class Importer(object): def __init__(self, path=None): self.path = path def find_module(self, fullname): print "*** %s ***" % fullname _installed=False def install(suffixes=None): global _installed if not _installed: Importer.suffixes = suffixes or [] path_hooks.append(Importer) sys.path_importer_cache.clear()
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4