summaryrefslogtreecommitdiffstats
path: root/HACKING.rst
diff options
context:
space:
mode:
authorZhongyue Luo <zhongyue.nah@intel.com>2013-01-31 14:24:29 +0800
committerZhongyue Luo <zhongyue.nah@intel.com>2013-01-31 15:00:02 +0800
commitea46d462fcfd7d393b71b14206a5e6d86bf1994b (patch)
treee6d2b6b510ae059a53df36c8dff667a435eb95eb /HACKING.rst
parentc29263c4a81d2e71a3d6e36eb32e5df9d2c8fb05 (diff)
downloadoslo-ea46d462fcfd7d393b71b14206a5e6d86bf1994b.tar.gz
oslo-ea46d462fcfd7d393b71b14206a5e6d86bf1994b.tar.xz
oslo-ea46d462fcfd7d393b71b14206a5e6d86bf1994b.zip
Fixes 'not in' operator usage
Change-Id: Ibac9853fc72e2452fa5e2b3a493bd03523faabfb
Diffstat (limited to 'HACKING.rst')
-rw-r--r--HACKING.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst
index 7dda11a..3f6a3ed 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -27,6 +27,18 @@ General
mylist = Foo().list() # OKAY, does not shadow built-in
+- Use the "not in" operator for collection membership evaluation. Example::
+
+ if not X in Y: # BAD, hard to understand
+ 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
+ pass
+
+
TODO vs FIXME
-------------