diff options
author | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-02-04 11:18:43 +0800 |
---|---|---|
committer | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-02-04 11:47:41 +0800 |
commit | 631247ffac33270ff68c8721e36df4d0542f416c (patch) | |
tree | e86fea28ced0fdb494ff15f15d4044ca6e3bf839 /HACKING.rst | |
parent | bd5d9f08ecc3c1fade6dce809ee9edef1c226e54 (diff) | |
download | oslo-631247ffac33270ff68c8721e36df4d0542f416c.tar.gz oslo-631247ffac33270ff68c8721e36df4d0542f416c.tar.xz oslo-631247ffac33270ff68c8721e36df4d0542f416c.zip |
Update HACKING.rst per recent changes
Added "is not" usage with examples
Fixed "not in" usage description
https://review.openstack.org/#/c/20576/
and
https://review.openstack.org/#/c/20879/
Fixes a previous "not X in Y" grep corner case
Change-Id: I92ae642887de734a8562a528003d8092f5ff27d4
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/HACKING.rst b/HACKING.rst index 3f6a3ed..3cea316 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -26,16 +26,23 @@ General mylist = Foo().list() # OKAY, does not shadow built-in +- Use the "is not" operator when testing for unequal identities. Example:: -- Use the "not in" operator for collection membership evaluation. 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, hard to understand + 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 is Z): # OKAY, still better than all those 'not's + if not (X in Y or X in Z): # OKAY, still better than all those 'not's pass |