Invert Any/All in Body¶
Sourcery refactoring id: invert-any-all-body
¶
Description:¶
Simplifies any
and all
statements that can be inverted
Before:¶
b = any(not a for a in things)
After:¶
b = all(things)
Explanation:¶
A negation is more difficult to read than a straightforward statement. This refactoring inverts the any or all to remove the negation.