mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Add documentation to style guide as to why absolute imports should be avoided.
This commit is contained in:
parent
bd002f97da
commit
949c882278
@ -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
|
||||
==================
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user