[Python-Dev] how important is setting co_filename for a module being imported to what __file__ is set to?

Nick Coghlan ncoghlan at gmail.com
Mon Aug 31 15:13:55 CEST 2009


Brett Cannon wrote:
>> You can use the C implementation of io, _io, which has a full
>> buffering implementation. Of course, that also makes it a better
>> harder for other implementations which may wish to use importlib
>> because the io library would have to be completely implemented...
> 
> True. I guess it's a question of whether making importlib easier to
> maintain and as minimally reliant on C-specific modules is more/less
> important than trying to bootstrap it in for CPython for __import__ at
> some point.

I'd suggest preferring _io, but falling back to the Python io module if
the accelerated version doesn't exist. You should get the best of both
worlds that way (no bootstrap issues in CPython and other
implementations with an _io module, but a still functional importlib in
other implementations).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list