[Python-Dev] importing from files with currently invalid names (original) (raw)
Skip Montanaro skip at pobox.com
Wed Mar 3 15:32:31 EST 2004
- Previous message: [Python-Dev] Pep 318 - new syntax (esp for wrappers)
- Next message: [Python-Dev] [ python-Patches-876206 ] scary frame speed hacks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I just responded to and closed a bug report which asked why
import report-manager
or
import "report-manager"
doesn't work. It got me to thinking, with the import ... as ... form Python could support importing from non-identifier file names by giving some variant of the file name as a string literal:
import "report-manager" as report_manager
import "report-manager.py" as report_manager
import "/etc/site/parameters" as report_manager
Is that extra flexibility possibly worthwhile? I know Guido's not keen on polluting the import statement with path information (the third case), but the others seem like they might be useful.
Adding this support shouldn't break anything since the language grammar doesn't currently support string literals as the module name.
Skip
- Previous message: [Python-Dev] Pep 318 - new syntax (esp for wrappers)
- Next message: [Python-Dev] [ python-Patches-876206 ] scary frame speed hacks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]