En Wed, 20 May 2009 20:18:02 -0300, LittleGrasshopper <seattleha...@yahoo.com> escribió:

New to the group, this is my first post...

It appears that either absolute imports (or my brain) aren't working.
Given a module string.py which is in the same directory as a.py:

#File a.py
from __future__ import absolute_import

import string

print string # Module imported is string.py in current directory, not
standard library module

absolute_import helps with imports inside a package (those are "relative" imports, relative to the package). If a module is located in a directory listed in sys.path, an absolute import will find it. I don't think there is a way to avoid shadowing a standard module (other than ensuring the standard directories come first in sys.path).

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to