Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect useless copy/deepcopy #9509

Open
fc-asad opened this issue Mar 19, 2024 · 1 comment
Open

Detect useless copy/deepcopy #9509

fc-asad opened this issue Mar 19, 2024 · 1 comment
Labels
Discussion 🤔 Enhancement ✨ Improvement to a component Needs decision 🔒 Needs a decision before implemention or rejection

Comments

@fc-asad
Copy link

fc-asad commented Mar 19, 2024

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 fc-asad added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 19, 2024
@Pierre-Sassoulas Pierre-Sassoulas added Enhancement ✨ Improvement to a component Discussion 🤔 Needs decision 🔒 Needs a decision before implemention or rejection and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 19, 2024
@Pierre-Sassoulas
Copy link
Member

+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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion 🤔 Enhancement ✨ Improvement to a component Needs decision 🔒 Needs a decision before implemention or rejection
Projects
None yet
Development

No branches or pull requests

2 participants