From 949c882278eef3b030c2fad49a8281c4664fb31d Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 21 Aug 2013 00:04:21 +0100 Subject: [PATCH] Add documentation to style guide as to why absolute imports should be avoided. --- doc/topics/conventions/style.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/topics/conventions/style.rst b/doc/topics/conventions/style.rst index 7ce473af8e..57a4f7441f 100644 --- a/doc/topics/conventions/style.rst +++ b/doc/topics/conventions/style.rst @@ -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` would have to +also import :mod:`absolute_import`, which should be +avoided. + +.. _`absolute imports`: http://www.python.org/dev/peps/pep-0328/#rationale-for-absolute-imports + + Vertical is Better ==================