[Python-Dev] Draft: PEP for imports (original) (raw)
Chris Reedy chrisandannreedy at comcast.net
Fri Jan 30 18:00:14 EST 2004
- Previous message: [Python-Dev] Draft: PEP for imports
- Next message: [Python-Dev] Re: 2.2 features
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Armin Rigo wrote:
import neatTricks in "/home/guido/lib/python" # no package import package.module in "/home/guido/lib/python" # package import foo in "." # relative import from neatTricks in "../cmds" import a, b, c s=os.path.join("some", "where"); import foo in s # expression path
where the semantics would be to search sys.path if and only if no 'in' clause is specified. ('in' doesn't sound quite right...) Armin -
Thinking about the semantics of the above, including corner cases, I find myself wanting to make the semantics of:
in "
to be equivalent to:
sys.path.insert(0, "
That doesn't seem to be quite equivalent to what you've proposed. On the other hand, that seems to provide at least semi-reasonable answers to questions about what happens to sys.modules, what happens if sys.modules['package'] is defined when importing package.module, what's the correct search path when a module being imported does an import, etc.
Having said that, that makes me feel negatively about the proposal, since you could do it yourself directly.
Chris
- Previous message: [Python-Dev] Draft: PEP for imports
- Next message: [Python-Dev] Re: 2.2 features
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]