Re: [Python-Dev] Write All New Import Hooks (PEP 302) in Python, Not C

Just van Rossum <just@letterror.com> writes:
I've not really been following this discussion with utmost care, but the name "meta_path" doesn't move me. Wouldn't sys.importers be better name? Or maybe I'm misunderstanding it's intent -- which is still an argument for a better name. Cheers, M. -- Also, remember to put the galaxy back when you've finished, or an angry mob of astronomers will come round and kneecap you with a small telescope for littering. -- Simon Tatham, ucam.chat, from Owen Dunn's review of the year

Michael Hudson wrote:
I don't like the name much either, but it _does_ fit quite well as the idea is that sys.path importing gets invoked through an item on meta_path. Perhaps this sketch helps a little: sys.meta_path = [ BuiltinImporter(), # handles builtin modules FrozenImporter(), # handles frozen modules PathImporter(), # handles sys.path ] def find_module(fullname, path=None): for i in sys.meta_path: l = i.find_module(fullname, path) if l is not None: return l return None class PathImporter: def find_module(self, fullname, path=None): if path is None: path = sys.path for p in path: i = get_path_importer(p) # deals with sys.path_hooks & cache if i is not None: l = i.find_module(fullname) if l is not None: return l retun None This is how you should look at it, even though it doesn't match the implementation (yet). Right now you should imagine those three objects on meta_path as an implicit extension of sys.meta_path, they don't yet physically exist. This should change in the near future, perhaps even with 2.3a2. Just

During his review of the Mersenne Twister code (in python/nondist/sandbox/twister), Martin raised a question for python-dev about the best way to handle the copyright notice in the original code at http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html . I incorporated the copyright notice into the head of _random.c, but the notice seems to indicate that it should also be in the documentation (either in librandom.tex or random.py). I don't think having multiple copies of the copyright notice or having clutter in the LaTeX docs is desirable. Inclusion by reference or footnote may be sufficient. Do you guys have any thoughts on the best way to resolve this one? It is my only unanswered review comment for the module before loading it for the alpha release. Raymond Hettinger

I'd like to see a LICENSES.txt file added to the distribution, into which we copy the licenses for all the external software we *may* ship with a Python distribution. On Windows that's quite a lot (zlib, bz2, Tcl/Tk, OpenSSL, ...). I'm not even thinking about the legalities here, it's just good manners to acknowledge other peoples' work. It's also good manners for people building on our work to pass on the licenses too, and most licenses formally require that they do so.
The issue isn't unique to you, so don't feel you have to solve it.
It is my only unanswered review comment for the module before loading it for the alpha release.
I expect to make a few hours to dig into the sandbox code tonight, but don't let that influence you <wink>.

Michael Hudson wrote:
I don't like the name much either, but it _does_ fit quite well as the idea is that sys.path importing gets invoked through an item on meta_path. Perhaps this sketch helps a little: sys.meta_path = [ BuiltinImporter(), # handles builtin modules FrozenImporter(), # handles frozen modules PathImporter(), # handles sys.path ] def find_module(fullname, path=None): for i in sys.meta_path: l = i.find_module(fullname, path) if l is not None: return l return None class PathImporter: def find_module(self, fullname, path=None): if path is None: path = sys.path for p in path: i = get_path_importer(p) # deals with sys.path_hooks & cache if i is not None: l = i.find_module(fullname) if l is not None: return l retun None This is how you should look at it, even though it doesn't match the implementation (yet). Right now you should imagine those three objects on meta_path as an implicit extension of sys.meta_path, they don't yet physically exist. This should change in the near future, perhaps even with 2.3a2. Just

During his review of the Mersenne Twister code (in python/nondist/sandbox/twister), Martin raised a question for python-dev about the best way to handle the copyright notice in the original code at http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html . I incorporated the copyright notice into the head of _random.c, but the notice seems to indicate that it should also be in the documentation (either in librandom.tex or random.py). I don't think having multiple copies of the copyright notice or having clutter in the LaTeX docs is desirable. Inclusion by reference or footnote may be sufficient. Do you guys have any thoughts on the best way to resolve this one? It is my only unanswered review comment for the module before loading it for the alpha release. Raymond Hettinger

I'd like to see a LICENSES.txt file added to the distribution, into which we copy the licenses for all the external software we *may* ship with a Python distribution. On Windows that's quite a lot (zlib, bz2, Tcl/Tk, OpenSSL, ...). I'm not even thinking about the legalities here, it's just good manners to acknowledge other peoples' work. It's also good manners for people building on our work to pass on the licenses too, and most licenses formally require that they do so.
The issue isn't unique to you, so don't feel you have to solve it.
It is my only unanswered review comment for the module before loading it for the alpha release.
I expect to make a few hours to dig into the sandbox code tonight, but don't let that influence you <wink>.
participants (4)
-
Just van Rossum
-
Michael Hudson
-
Raymond Hettinger
-
Tim Peters