summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2013-03-29 10:31:11 -0700
committerTres Seaver <tseaver@palladion.com>2013-03-29 10:31:11 -0700
commitbd10de6b53905fa260b44ae6f468bac1ea30b91b (patch)
treeef4610ee54a33fa34a74610524e18b3332530c39
parent499039821338b307609d57a96a2b1bae3c8838a3 (diff)
parentd886c933784e499a6243b0ebbfc04fb0bb2be4fa (diff)
downloadpyramid-bd10de6b53905fa260b44ae6f468bac1ea30b91b.tar.gz
pyramid-bd10de6b53905fa260b44ae6f468bac1ea30b91b.tar.bz2
pyramid-bd10de6b53905fa260b44ae6f468bac1ea30b91b.zip
Merge pull request #945 from tshepang/imports
mention a coding convention
-rw-r--r--docs/conventions.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/conventions.rst b/docs/conventions.rst
index 4cffd1084..21b506623 100644
--- a/docs/conventions.rst
+++ b/docs/conventions.rst
@@ -91,3 +91,24 @@ discussed on a page, is rendered like so:
Sidebar information.
+When multiple objects are imported from the same package,
+the following convention is used:
+
+ .. code-block:: python
+
+ from foo import (
+ bar,
+ baz,
+ )
+
+It may look unusual, but it has advantages:
+
+* It allows one to swap out the higher-level package ``foo`` for something
+ else that provides the similar API. An example would be swapping out
+ one Database for another (e.g. graduating from SQLite to PostgreSQL).
+
+* Looks more neat in cases where a large number of objects get imported from
+ that package.
+
+* Adding/removing imported objects from the package is quicker and results
+ in simpler diffs.