PEP8 type comparison
Bug #910295 reported by
Zhongyue Luo
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Wishlist
|
Zhongyue Luo |
Bug Description
According to PEP8,
Programming Recommendations
- Comparisons to singletons like None should always be done with
'is' or 'is not', never the equality operators.
- Don't compare boolean values to True or False using ==
Yes: if greeting:
No: if greeting == True:
Worse: if greeting is True:
Therefore, all comparisons of value XXX to None
should be done by 'XXX is None' or 'XXX is not None'.
All comparison of value XXX to True or False
should be done by 'if XXX' or 'if not XXX'
The "== None", "== True", "== False", and "!= None" in sqlalchemy's
where(), or_(), filter(), and_(), and select() functions should not be changed.
Changed in nova: | |
assignee: | nobody → LZY (lzyeval) |
summary: |
- PEP8 "None" type comparison + PEP8 type comparison |
description: | updated |
description: | updated |
description: | updated |
Changed in nova: | |
importance: | Undecided → Wishlist |
Changed in nova: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Comparisons in sqlalchemy filter's should not be changed this way.