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

# Merge isinstance

#### Sourcery refactoring id: `merge-isinstance`

#### Description:

Combines together multiple `isinstance` functions

#### Before:

```python
if isinstance(hat, Bowler) or isinstance(hat, Fedora):
    wear(hat)
```

#### After:

```python
if isinstance(hat, (Bowler, Fedora)):
    wear(hat)
```

#### Explanation:

When you want to check whether something is one of multiple different types, you
can merge the two `isinstance` checks into a single call.

This is shorter while staying nice and easy to read.
