changeset 1133:9baa47482ccc

coding_style: Added a few more coding guidelines for compatibility with various Python versions
author Olivier Delalleau <delallea@iro>
date Wed, 15 Sep 2010 15:20:13 -0400
parents f0a1b88367b0
children 0653a85ff2e8
files doc/v2_planning/coding_style.txt
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/v2_planning/coding_style.txt	Wed Sep 15 14:02:45 2010 -0400
+++ b/doc/v2_planning/coding_style.txt	Wed Sep 15 15:20:13 2010 -0400
@@ -366,6 +366,10 @@
     * Imports should be listed in alphabetical order. It makes it easier to
       verify that something is imported, and avoids duplicated imports.
 
+    * Use absolute imports only. This is compatible across a wider range of
+      Python versions, and avoids confusion about what is being
+      imported.
+
     * Use a leading underscore '_' for internal attributes / methods,
       but avoid the double underscore '__' unless you know what you are
       doing.
@@ -374,6 +378,18 @@
         if __name__ == '__main__':
             sys.exit(main())
 
+    * No conditional expression (not supported in Python 2.4). These are
+      expressions of the form
+        x = y if condition else z
+
+    * Use either "try ... except" or "try ... finally", but do not mix
+      "except" with "finally" (which is not supported in Python 2.4).
+
+    * Do not use the `any` and `all` builtin functions (they are not supported
+      in Python 2.4).
+
+    * Do not use the `hashlib` module (not supported in Python 2.4).
+
 Mercurial commits
 -----------------