# HG changeset patch # User Olivier Delalleau # Date 1284578413 14400 # Node ID 9baa47482ccc9acb914080337edc836efb95c313 # Parent f0a1b88367b03f4afcc5184b5d3c3ecc9f158418 coding_style: Added a few more coding guidelines for compatibility with various Python versions diff -r f0a1b88367b0 -r 9baa47482ccc doc/v2_planning/coding_style.txt --- 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 -----------------