diff options
-rw-r--r-- | HACKING.rst | 12 | ||||
-rw-r--r-- | openstack/common/rpc/common.py | 2 |
2 files changed, 13 insertions, 1 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 ------------- diff --git a/openstack/common/rpc/common.py b/openstack/common/rpc/common.py index 8af2f03..357ee9d 100644 --- a/openstack/common/rpc/common.py +++ b/openstack/common/rpc/common.py @@ -289,7 +289,7 @@ def deserialize_remote_exception(conf, data): # NOTE(ameade): We DO NOT want to allow just any module to be imported, in # order to prevent arbitrary code execution. - if not module in conf.allowed_rpc_exception_modules: + if module not in conf.allowed_rpc_exception_modules: return RemoteError(name, failure.get('message'), trace) try: |