Re: [Python-Dev] Proposal: expose PEP 302 facilities via 'imp' and 'pkgutil'

2006-04-12 Thread Nick Coghlan
Phillip J. Eby wrote: > At 08:39 PM 4/12/2006 +1000, Nick Coghlan wrote: >> In this particular case, it would be a Python module "imp.py" that >> included the line "from _imp import *" (where _imp is the current >> C-only module with a different name). > > I don't think that's going to work, sin

Re: [Python-Dev] Proposal: expose PEP 302 facilities via 'imp' and 'pkgutil'

2006-04-12 Thread Phillip J. Eby
At 08:39 PM 4/12/2006 +1000, Nick Coghlan wrote: >In this particular case, it would be a Python module "imp.py" that >included the line "from _imp import *" (where _imp is the current C-only >module with a different name). I don't think that's going to work, since importing won't work until _imp

Re: [Python-Dev] Proposal: expose PEP 302 facilities via 'imp' and 'pkgutil'

2006-04-12 Thread Nick Coghlan
Phillip J. Eby wrote: > At 07:43 AM 4/12/2006 +1000, Nick Coghlan wrote: >> Phillip J. Eby wrote: >> > I propose to create a new API, 'imp.find_loader()' and have it >> return a PEP >> > 302-compatible loader object, even for cases that would normally be >> handled >> > via 'imp.load_module()'.

Re: [Python-Dev] Proposal: expose PEP 302 facilities via 'imp' and 'pkgutil'

2006-04-11 Thread Phillip J. Eby
At 07:43 AM 4/12/2006 +1000, Nick Coghlan wrote: >Phillip J. Eby wrote: > > I propose to create a new API, 'imp.find_loader()' and have it return a > PEP > > 302-compatible loader object, even for cases that would normally be > handled > > via 'imp.load_module()'. In such cases, the loader retur

Re: [Python-Dev] Proposal: expose PEP 302 facilities via 'imp' and 'pkgutil'

2006-04-11 Thread Nick Coghlan
Phillip J. Eby wrote: > I propose to create a new API, 'imp.find_loader()' and have it return a PEP > 302-compatible loader object, even for cases that would normally be handled > via 'imp.load_module()'. In such cases, the loader returned would be an > instance of one of a loader class similar

[Python-Dev] Proposal: expose PEP 302 facilities via 'imp' and 'pkgutil'

2006-04-11 Thread Phillip J. Eby
I just noticed that two stdlib modules (runpy and test.test_importhooks) contain reimplementations of the base PEP 302 algorithm, or loaders wrapping the standard (pre-302) import machinery. Meanwhile, the 'imp' module exports an undocumented IMP_HOOK constant (since Python 2.3), that is used i