> ## 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 List Appends Into Extend

#### Sourcery refactoring id: `merge-list-appends-into-extend`

#### Description:

Merge consecutive list appends into a single extend.

#### Before:

```python
my_list.extend([1, 2])
my_list.append(3)
my_list.append(4)
my_list.extend((5, 6, 7))
my_list.append(8)
my_list.append(9)
```

#### After:

```python
my_list.extend([1, 2, 3, 4, 5, 6, 7, 8, 9])
```

#### Explanation:

When adding multiple items to a list, it is cleaner to combine consecutive calls
to `list.append` or `list.extend` into a single `list.extend` when possible.
