← Back to team overview

yahoo-eng-team team mailing list archive

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

 

I don't think spamming multiple projects with false bugs is a good idea.
Please stop.

** No longer affects: ceilometer

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

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

Status in Cinder:
  In Progress
Status in Glance:
  In Progress
Status in neutron:
  In Progress
Status in OpenStack Compute (nova):
  In Progress
Status in Rally:
  In Progress
Status in OpenStack Object Storage (swift):
  In Progress

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

  This change will be more obvious and more readable, and is probably
  cheaper than computing a set intersection, too.

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