[x] I think this refactoring is useful for everyone (if it's too specific, consider a custom rule)
[x] I have checked there are no similar issues suggesting the same thing
Description
Extending the list-comprehension for zip-for-loops. Currently, only merge-list-appends-into-extend is applied, but there might be cases where a double-for-loop / pydantic will be more elegant.
Code Before
_list = []
for i,j in zip(range(10), range(10)[::-1]):
_list.append(i)
_list.append(j)
print(_list)
will sourcery currently refactor like this:
_list = []
for i,j in zip(range(10), range(10)[::-1]):
_list.extend((i, j))
print(_list)
Checklist
Description
Extending the list-comprehension for
zip-for-loops
. Currently, only merge-list-appends-into-extend is applied, but there might be cases where a double-for-loop / pydantic will be more elegant.Code Before
will
sourcery
currently refactor like this:Code After
However, this can also be achieved as a one-liner