'Unnecessary use of a comprehension'
Instead of using an identitiy comprehension, consider using the list, dict or set constructor. It is faster and simpler.
The comprehension in the following example does not change the contents of the list.
def example(arg): lst = [1,2,3] other_lst = [elem for elem in lst]
3:0: R1721: Unnecessary use of a comprehension
This kind of comprehension is usually applied to ensure that a iterable of
any type is normalized to a list. The message description suggest to use the
list constructor instead:
def example(arg): lst = (1,2,3) other_lst = list(lst)
No issues found.