What is the underlying mechanism in Python that handles such "aliases"?
>>> import os.path
>>> os.path.__file__
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.pyc'
What is the underlying mechanism in Python that handles such "aliases"?
>>> import os.path
>>> os.path.__file__
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.pyc'
Taken from os.py on CPython 2.6:
sys.modules['os.path'] = path
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
devnull)
path
is defined earlier as the platform-specific module:
if 'posix' in _names:
name = 'posix'
linesep = '\n'
from posix import *
try:
from posix import _exit
except ImportError:
pass
import posixpath as path
import posix
__all__.extend(_get_exports_list(posix))
del posix
elif 'nt' in _names:
# ...