[Python-Dev] New universal import mechanism ( Re: [Python-checkins] python/dist/src/Python import.c,2.210,2.211)

Just van Rossum just@letterror.com
Tue, 3 Dec 2002 09:41:26 +0100


Wiktor Sadowski wrote:

> Just van Rossum  wrote:
> 
> >>Could you please post a normal diff of your patch? It looks very
> >>interesting.
> Sorry, I haven't got time for cleaning up my modified Python C code
> and  building the diffs.
> 
> >.I'm not entirely sure yet how my idea and yours could be
> >integrated, but I think
> > it's work a look.
> 
> The concept is the same , there are differences in implementations.
> The implementation you have posted is much more pure Python oriented.
> I am using C structures and pointers to C functions (wherever
> possible) instead of Python objects (well PyObjects are still C
> structures) , so maybe it's a little faster (maybe not) 

I'm sure yours will be faster. However, the _same_ stuff is needed on the Python
end, and I think it can still be made fairly easy to do what you want with
sys.import_hooks. It can probably use a new C API to make things more
straightforward.

> Looks like I was wasting my time.;)

Not at all! If it wan't for your post I might not have implemented the
import_hooks stuff nearly as quickly, if at all ;-)

import.c is a mess, and I think my patch opens doors to actually clean it up
(perhaps for 2.4).

Just