Skip to content

Invert any & all

Sourcery refactoring id: invert-any-all

Description:

Switches not any or not all statements to all or any statements respectively

Before:

b = not all(a > b for a in things)

After:

b = any(a <= b for a in things)

Explanation:

A negation is more difficult to read than a straightforward statement. This refactoring inverts the any or all to remove the negation.

Back to top