diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-09 18:25:11 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-09 18:25:11 +0000 |
| commit | 0b2c7ec9694013fa89062c3989d36a75f5b85ca2 (patch) | |
| tree | 4157e20a44bf52ac862397243973c45ff0eabe7d | |
| parent | dbb4061563e552266d6b6d0793a94135cb25ca73 (diff) | |
| parent | 631247ffac33270ff68c8721e36df4d0542f416c (diff) | |
| download | oslo-0b2c7ec9694013fa89062c3989d36a75f5b85ca2.tar.gz oslo-0b2c7ec9694013fa89062c3989d36a75f5b85ca2.tar.xz oslo-0b2c7ec9694013fa89062c3989d36a75f5b85ca2.zip | |
Merge "Update HACKING.rst per recent changes"
| -rw-r--r-- | HACKING.rst | 13 | ||||
| -rw-r--r-- | openstack/common/scheduler/filters/json_filter.py | 2 |
2 files changed, 11 insertions, 4 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 diff --git a/openstack/common/scheduler/filters/json_filter.py b/openstack/common/scheduler/filters/json_filter.py index 273d55e..9118bc2 100644 --- a/openstack/common/scheduler/filters/json_filter.py +++ b/openstack/common/scheduler/filters/json_filter.py @@ -32,7 +32,7 @@ class JsonFilter(filters.BaseHostFilter): if len(args) < 2: return False if op is operator.contains: - bad = not args[0] in args[1:] + bad = args[0] not in args[1:] else: bad = [arg for arg in args[1:] if not op(args[0], arg)] |
