[Python-Dev] __import__ problems

Brett Cannon brett at python.org
Sun Nov 30 20:13:49 CET 2008


On Sun, Nov 30, 2008 at 05:02, Mart Somermaa <mrts at mrts.pri.ee> wrote:
> Brett Cannon wrote:
>
>> The old-hands on python-dev know this is where  I plug  my import
>> rewrite vaporware. It will be in 3.1, and as part of it there will be
>> a new API for handling direct imports. Jacob Kaplan-Moss and I have
>
> Sounds good. I can finally rest in peace :) . May I suggest
> that you disable the hack while you are at it as well so that
> people will be aware of their misdoings?
>

Possibly since 'warnings' was re-written in C partially so it could be
used by the import rewrite. I will worry about that more when the code
actually lands.

>> talked about Django's need for this as PyCon so I am very aware of
>> needing this API and it will be addressed in the simplest way possible
>> (heck, the __import__ API might actually become a wrapper around the
>> simpler API in the end).
>
> Even better (the bracketed part).
>

Well, it's only a maybe. There  is the balance between a good API for
people versus a good API for the compiler to compile to. Not sure if
they will line up nicely or not.

>> And since nothing can go into 3.0 anyway,
>> there is no need to rush into solving this right now.
>
> Agreed, I just wanted to get the ball rolling.
>
> Let me know if you want me to do some gruntwork (tests,
> documentation) once the improved implementation is taking shape.
>

As of right now I am rewriting the tests to use more mock objects as I
was originally testing too often against actual files. I also needed
to untangle the tests as I was testing too much at once. Unfortunately
it's not grunt work as I am purposefully not looking at the old tests
to make sure that I get as much test coverage as possible in terms of
semantics (they are rather involved as I am sure you have noticed).

After that it's little compatibility things and then cleaning up the
bootstrapping code.

As for the docs, once the code  is in the docs will need to be
thoroughly rewritten so they are finally updated to include PEP 302.
But one thing at a time. =)

-Brett


More information about the Python-Dev mailing list