Add documentation to style guide as to why absolute imports should be avoided.

This commit is contained in:
Pedro Algarvio 2013-08-21 00:04:21 +01:00
parent bd002f97da
commit 949c882278

View File

@ -115,6 +115,21 @@ This is a good way to import exceptions:
from salt.exceptions import CommandExecutionError
Absolute Imports
----------------
Although `absolute imports`_ seems like an awesome idea, please do not use it.
Extra care would be necessary all over salt's code in order for absolute
imports to work as supposed. Believe it, it has been tried before and, as a
tried example, by renaming ``salt.modules.sysmod`` to ``salt.modules.sys``, all
other salt modules which needed to import :mod:`sys<python2:sys>` would have to
also import :mod:`absolute_import<python2:__future__>`, which should be
avoided.
.. _`absolute imports`: http://www.python.org/dev/peps/pep-0328/#rationale-for-absolute-imports
Vertical is Better
==================