[Python-Dev] Relative import (original) (raw)
Nick Coghlan ncoghlan at iinet.net.au
Wed Dec 17 07:58:20 EST 2003
- Previous message: [Python-Dev] Re: Relative import
- Next message: [Python-Dev] Relative import
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing wrote:
So I think we really want three kinds of module reference:
A: Explicitly absolute B: Explicitly relative to the current module C: Searched for upwards in the package hierarchy from the current module (Note that C is a generalisation of the current "ambiguous" references which only look in two places.)
Alternate spellings (plus category D, which is "Python 2.3 semantics"):
A: from absolute.dotted.name import foo B: from relative.dotted.name import bar C: from heirarchy.dotted.name import foobar D: from dotted.name import barfoo
I believe this spelling would only require import to handle the special cases as the first 'package' name (although having the compiler recognise them may be a later optimisation), and should also work with straight "import absolute.dotted.name.foo" statements.
Then Guido's migration plan would apply to the progression of the D semantics from the Python 2.3 model to being a shorthand for the absolute semantics.
And once that has happened, then we could get rid of the 'absolute' version in the name of TOOWTDI.
Regards, Nick.
-- Nick Coghlan | Brisbane, Australia Email: ncoghlan at email.com | Mobile: +61 409 573 268
- Previous message: [Python-Dev] Re: Relative import
- Next message: [Python-Dev] Relative import
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]