From ea46d462fcfd7d393b71b14206a5e6d86bf1994b Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Thu, 31 Jan 2013 14:24:29 +0800 Subject: Fixes 'not in' operator usage Change-Id: Ibac9853fc72e2452fa5e2b3a493bd03523faabfb --- HACKING.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'HACKING.rst') 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 ------------- -- cgit