← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1538518] Re: Avoid using `len(x)` to check if x is empty

 

** Description changed:

  `len()` is used to check if collection (e.g., a dict, list, set, etc.)
  has items. As collections have a boolean representation too, it is
  better to directly check for true / false.
  
  rally/common/utils.py
  rally/task/utils.py
  rally/task/validation.py
  tests/unit/doc/test_specs.py
- 
- This change will be more obvious and more readable, and is probably
- cheaper than computing a set intersection, too.

** No longer affects: glance

** No longer affects: nova

** No longer affects: swift

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1538518

Title:
  Avoid using `len(x)` to check if x is empty

Status in Rally:
  Fix Released

Bug description:
  `len()` is used to check if collection (e.g., a dict, list, set, etc.)
  has items. As collections have a boolean representation too, it is
  better to directly check for true / false.

  rally/common/utils.py
  rally/task/utils.py
  rally/task/validation.py
  tests/unit/doc/test_specs.py

To manage notifications about this bug go to:
https://bugs.launchpad.net/rally/+bug/1538518/+subscriptions