PEP 328 update

Aahz aahz at pythoncraft.com
Mon May 3 12:14:43 EDT 2004


In article <40967109$1 at nntp0.pdx.net>,
Scott David Daniels  <Scott.Daniels at Acm.Org> wrote:
>Aahz wrote:
>>
>> PEP 328 (``import`` changes) has been updated and is available at
>> http://www.python.org/peps/pep-0328.html
>> 
>> Comments on the revised version are welcome.  One area where feedback is
>> particularly desired is on the frequency of relative imports inside
>> packages in current code, both in absolute terms and as a percentage of
>> all imports.
>
>I am unclear as to why "import ..moduleA as A" is not allowed.  The only
>rationale given for disallowing relative imports like "import .foo" is 
>that .foo is unacceptable as a name.  I'd propose a mandatory AS-clause
>if the MODULE begins with a period.
>
>This would allow me to do something like "import . as mypackage" -- a 
>case which is perhaps unnecessary.  I just found the "must use the
>from-style imports" surprising (I agree the change is not vital).

I'm no expert, but I'd bet that Python's grammar can't support this.
Someone will be by to correct me if I'm wrong.  ;-)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I used to have a .sig but I found it impossible to please everyone..."  --SFJ



More information about the Python-list mailing list