Rule request
Thesis
The list has a set of methods that duplicates operations that you can do with + operator or slices:
# bad
items += [item]
# good
items.append(item)
# bad
items = [item] + items
# good
items.insert(0, item)
# bad
items += other
# good
items.extend(other)
# bad
items = items[::-1]
# good
items.reverse()
# bad
items = sorted(items)
# good
items.sort()
# bad
other = items[:]
# good
other = items.copy()
# bad
items[:] = []
# good
items.clear()
# bad
items = items[:-1]
# good
items.pop()
Reasoning
We have two ways to do something. Let's prefer a more descriptive way.
This issue contains a lot of related cases. Consider splitting it by smaller ones.
Rule request
Thesis
The list has a set of methods that duplicates operations that you can do with
+operator or slices:Reasoning
We have two ways to do something. Let's prefer a more descriptive way.
This issue contains a lot of related cases. Consider splitting it by smaller ones.