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

# Switch

#### Sourcery refactoring id: `switch`

#### Description:

Simplify conditionals into a form more like a `switch` statement

#### Before:

```python
if item.a == 1:
    q += 2
elif item.a == 2:
    q += 2
elif item.a == 4:
    q = 0
```

#### After:

```python
if item.a in [1, 2]:
    q += 2
elif item.a == 4:
    q = 0
```

#### Explanation:

This refactoring examines complex conditionals where a variable is being
compared to various different values, and tries to put them into the simplest
form possible, eliminating duplicated blocks.
