On Sun, 11 Jan 2015 23:00:45 -0700, Ian Kelly wrote:

> On Sun, Jan 11, 2015 at 10:31 PM, Steven D'Aprano <st...@pearwood.info>
> wrote:
>> But bizarrely, you can import os.path this way!
>>
>> py> import os.path
>> py> os.path
>> <module 'posixpath' from '/usr/local/lib/python3.3/posixpath.py'> py>
>> os.__package__
>> ''
>>
>>
>>
>> By what wizardry does this work?
> 
> By the wizardry of adding an entry to sys.modules.
> 
> https://hg.python.org/cpython/file/8b3c609f3f73/Lib/os.py#l112


/head-desk

It's always the simplest thing... 

Thanks.

-- 
Steve
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to