diff options
author | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-01-31 14:23:27 +0800 |
---|---|---|
committer | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-02-04 10:13:18 +0800 |
commit | 4cd7abaa350cc7b465b90a26e87f5c73e32a2d1f (patch) | |
tree | 78b226605f6ca1ecf67e86462f0c2e5d5c0b4d73 /HACKING.rst | |
parent | 4722c84fb90c51fb5810ad7b46c48230ecee1a6c (diff) | |
download | keystone-4cd7abaa350cc7b465b90a26e87f5c73e32a2d1f.tar.gz keystone-4cd7abaa350cc7b465b90a26e87f5c73e32a2d1f.tar.xz keystone-4cd7abaa350cc7b465b90a26e87f5c73e32a2d1f.zip |
Fixes 'not in' operator usage
Change-Id: I50a5bbe4800fc88b631701a6be0a0f9feec597d0
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst index cf6abb39..bf0befca 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -18,6 +18,24 @@ General - Do not name anything the same name as a built-in or reserved word - When defining global constants, define them before functions and classes - Avoid using "double quotes" where you can reasonably use 'single quotes' +- Use the "is not" operator when testing for unequal identities. Example:: + + if not X is Y: # BAD, intended behavior is ambiguous + pass + + if X is not Y: # OKAY, intuitive + pass + +- Use the "not in" operator for evaluating membership in a collection. Example:: + + if not X in Y: # BAD, intended behavior is ambiguous + pass + + if X not in Y: # OKAY, intuitive + pass + + if not (X in Y or X in Z): # OKAY, still better than all those 'not's + pass TODO vs FIXME |