[Python-Dev] Clarifications for import PEPs (302 and 328) (original) (raw)
Brett Cannon brett at python.org
Mon Apr 23 23:01:28 CEST 2007
- Previous message: [Python-Dev] styleguide inconsistency
- Next message: [Python-Dev] Clarifications for import PEPs (302 and 328)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
After my import rewrite, I discovered some things that were left out of both PEP 302 (import hooks) and PEP 328 (absolute/relative imports). I wanted to run them by everyone before I made the subsequent changes to the PEPs.
For PEP 302, a loader should raise ImportError if load_module fails w/o an explicit exception being raised. Also, name needs to be set along with file (if applicable as 'sys' does not define file) before the execution of code proceeds.
For PEP 328, None redirection (if 'pkg.string' is set to None the import machinery is supposed to automatically return the 'string' module) should be removed when absolute/relative imports become the default. The redirection was a hack to optimize for import's old semantics of trying a relative import first and then an absolute import. The new semantics do away with the fallback and thus this mechanism is worthless.
-Brett
- Previous message: [Python-Dev] styleguide inconsistency
- Next message: [Python-Dev] Clarifications for import PEPs (302 and 328)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]