> ## 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.

# None Compare

#### Sourcery refactoring id: `none-compare`

#### Description:

Replaces `==` with `is` when comparing to `None`

#### Before:

```python
if hat == None:
    raise NoHatException
```

#### After:

```python
if hat is None:
    raise NoHatException
```

#### Explanation:

In Python `is` refers to reference equality - where you want to check if
something is the same object. Equals `==` checks value equality, to check that
the objects are equal to each other. In Python the `None` object is a singleton,
so it is correct to use `is` when comparing to it.
