pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Detect useless copy/deepcopy

Open fc-asad opened this issue 1 year ago • 1 comments

Current problem

I have seen code where a copy/deepcopy of an immutable data is made. As far as I understand, it is a useless operation.

Desired solution

Pylint should detect when copy/deepcopy of an immutable object is made and generate an error.

Additional context

No response

fc-asad avatar Mar 19 '24 09:03 fc-asad

+1, but inferring if something is immutable is hard, so the check would be limited to known immutable type or the false positives would make this check unusable.

Pierre-Sassoulas avatar Mar 19 '24 20:03 Pierre-Sassoulas