Skip to content

Merge List Extend

Sourcery refactoring id: merge-list-extend

Description:

Create the list with values instead of creating an empty list and extending it with another list

Before:

hats_i_own = []
hats_i_own.extend(["panama, baseball_cap, bowler"])

After:

hats_i_own = ["panama", "baseball_cap", "bowler"]

Explanation:

When declaring a list with values it is much clearer to do so on one line rather than declaring an empty list and then extending it with values.