> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Equality Identity

#### Sourcery refactoring id: `equality-identity`

#### Description:

Simplify equality comparisons that are always `True` or `False`

#### Before:

```python
if 1 == 1:
    always_do_this()

if 1 != 1:
    never_do_this()
```

#### After:

```python
if True:
    always_do_this()

if False:
    never_do_this()
```

#### Explanation:

When comparing a value to itself, the outcome will always be `True`, as long as
the equality operator has not been overridden, and this also holds for the
opposite comparison and `False`. It is more readable to use a direct comparison
to the boolean value.
