diff options
author | Andy Grover <agrover@redhat.com> | 2014-11-13 11:44:11 -0800 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2014-11-13 11:44:11 -0800 |
commit | 83f435ba5c52611773a9d5f134c9f69f74f1f22a (patch) | |
tree | 8f04198ec181499ff84de5a11e8cb7ff08b5607c | |
parent | 1b23a7a8b48f176f749c075a793da1216c05d283 (diff) | |
download | rtslib-fb-83f435ba5c52611773a9d5f134c9f69f74f1f22a.tar.gz |
Use any() when testing for if an iterable is not empty
This prevents the effort of generating a full list of storage objects or
targets just to see if 1 or more exists.
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r-- | rtslib/root.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rtslib/root.py b/rtslib/root.py index 89c515a..301c2b9 100644 --- a/rtslib/root.py +++ b/rtslib/root.py @@ -163,7 +163,7 @@ class RTSRoot(CFSNode): ''' if clear_existing: self.clear_existing(confirm=True) - elif list(self.storage_objects) or list(self.targets): + elif any(self.storage_objects) or any(self.targets): raise RTSLibError("storageobjects or targets present, not restoring") errors = [] |