A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-March/042909.html below:

[Python-Dev] importing from files with currently invalid names

[Python-Dev] importing from files with currently invalid names [Python-Dev] importing from files with currently invalid namesSkip Montanaro skip at pobox.com
Wed Mar 3 15:32:31 EST 2004
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

More information about the Python-Dev mailing list

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