[Python-Dev] Relative import
Barry Warsaw
barry at python.org
Fri Dec 19 23:13:15 EST 2003
On Fri, 2003-12-19 at 16:30, Jack Diederich wrote:
> I'm at least a little confused with what people want, as far as I can tell
> import semantics have three things
> * what module to import
> * what name to give that import
> * where to look for it
>
> The 'from' keyword seems to be getting overloaded to mean both what module and
> where to find it, which the 'stdlib' tries to resolve. Most of the
> discussion has been about how to improve 'where to look'
Very interesting observation.
> I like syntax that reads most important left-to-right, so what about
> from MODULE import NAMES as RENAME searching HOW
> or
> import NAMES as RENAME from MODULE searching HOW
>
> searching could be 'asbolute' 'relative' or any of the other suggested
> words. If you wanted to get fancy it could be a list, if it isn't a list
> people who truly care could cascade try/except on ImportError.
I want to think about that more, but at first glance, it has some
appeal. Neat!
-Barry
More information about the Python-Dev
mailing list