Why does this work fine in python 2.x:
>> import matplotlib
>> import matplotlib.pylab
while this doesn't?
>> import matplotlib as mp
>> import mp.pylab
ImportError: No module named mp.pylab
isn't as just a short hand/alias for the module being used? it doesn't make sense that the first case works and second doesn't. why does it happen?
you can do same with os/path (from @kevin):
>> import os as o
>> import o.path
ImportError: No module named o.path
importis dumb and doesn't use variable name lookup on its identifiers the way you might expect. If this is so, I would guess thatimport matplotlib \n xyz = matplotlib \n import xyz.pylabwould also fail, so it's not necessarily the fault ofasspecifically.matplotlib.pylabfrommatplotlib/pylab.py.. (or perhapsmatplotlib/pylab/__init__.pyosandpathas replacements formatplotlibandpylab, and get the same result.