] > Re: [Python-projects] pylint: Warning about relative imports (Logilab.org)

Email Re: [Python-projects] pylint: Warning about relative imports

subject
Re: [Python-projects] pylint: Warning about relative imports
date
2005/10/20 13:50
Re: [Python-projects] pylint: Warning about relative imports

Nicolas,

I think there is a problem with the logic of relative import warnings:
some imports can be relative AND absolute.

In the standard "difflib" module, for example, you'll find "import re".
- It's a relative import,  because both files are in the same directory.
- It's an absolute import, because re.py is in a directory listed by
sys.path.
So I don't want any warning in this case.

IMO, the correct logic is to not to warn on relative imports, but to warn
on imports that are not absolute, i.e. that cannot be located from
sys.path.

What do you think about this?

--
Amaury Forgeot d'Arc
Ubix Development
www.ubitrade.com