importing os.path -- why does it work?
steve at pearwood.info
Mon Jan 12 08:21:10 CET 2015
On Sun, 11 Jan 2015 23:00:45 -0700, Ian Kelly wrote:
> On Sun, Jan 11, 2015 at 10:31 PM, Steven D'Aprano <steve at pearwood.info>
>> 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>
>> By what wizardry does this work?
> By the wizardry of adding an entry to sys.modules.
It's always the simplest thing...
More information about the Python-list