[Python-Dev] Relative vs. absolute imports

M.-A. Lemburg mal at egenix.com
Mon May 17 10:55:30 EDT 2004


Phillip J. Eby wrote:
> At 03:42 PM 5/17/04 +0200, M.-A. Lemburg wrote:
> 
>> I have a few questions about the PEP 328 which I'd like discussed:
>>
>> * Why do we absolutely need to change the current scheme
>>   of 'local, then absolute' for name resolution ?
> 
> Because there's no way to override the current scheme without calling 
> __import__ directly.

Are you saying that you are not going to change the default __import__()
implementation, only the way it is called ? (I wonder how you'll
enforce the 'absolute only' strategy then)

>> * How will the proposed 'absolute only' strategy affect
>>   the __import__() API ?
> 
> It doesn't change the API, only what arguments it gets called with.  
> Passing a different globals dictionary is all that's required to effect 
> an absolute import.
> 
>> * Will the DeprecationWarning only be raised for uses of
>>   'import xyz' and 'from xyz import a' or also for __import__() ?
> 
> It should not be for __import__().
> 
> 
>> * How do these semantics changes affect importers that hook
>>   into __import__ ? (imputil.py, ihooks.py, etc.)
>>
>> * What's the affect on zip imports or tools like py2exe,
>>   McMillan's installer, etc. ?
> 
> 
> Again, since the __import__ API isn't changing, it shouldn't affect any 
> of this.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 17 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
EuroPython 2004, Göteborg, Sweden                           20 days left

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the Python-Dev mailing list