Hello,

On Tue, 8 Dec 2020 22:32:42 +1100
Chris Angelico <[email protected]> wrote:

> On Tue, Dec 8, 2020 at 9:54 PM Paul Sokolovsky <[email protected]>
> wrote:
> >
> > Hello,
> >
> > On Tue, 8 Dec 2020 07:29:15 -0300
> > "Joao S. O. Bueno" <[email protected]> wrote:
> >  
> > > And how would Python compute the "full basename of the file to be
> > > imported"?  
> >
> > The way it does it usually.
> >  
> 
> That involves a number of searches for exact file and/or directory
> names, so you can't just search a path arbitrarily.
> 
> I would suggest that this is simultaneously too generic to be
> meaningful AND insufficiently generic to be useful.

I usually like such statements myself, but that one made me wonder...
Do you have an example (in the "single file == single module" domain)
where it will be "insufficiently generic to be useful"?

> It'd be best to
> just write what you want directly, using the tools in importlib.

Of course, the implementation of the above for CPython would be based on
importlib. And other implementations could implement that "directly",
for the background idea of it being how to implement import hooks as
frugally as possible, and easily allow to do most of what could be
wanted of single-file import hooking.

In that regard, the question is again about API such import hooks
offer. For example, how do you feel about "The hook should be aware
that there might have been previous hook(s), and it's current hook's
responsibility to call them." clause?

> 
> ChrisA

-- 
Best regards,
 Paul                          mailto:[email protected]
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/OBJ6CDGYYDQES6NQ53LSKGVXZNMAMEP5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to