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

Feature Request: delete variable from memory when it has been removed/renamed #7389

Open
aamster opened this issue Oct 17, 2019 · 1 comment

Comments

@aamster
Copy link

aamster commented Oct 17, 2019

The problem is that when there is a variable, say foo, but then foo has been renamed for example, and there is some other code that references foo within the notebook, then this other code might be using a variable which you intended to remove or rename. To me, it's a common annoyance with notebook coding, and I'm sure to others as well.

Of course if you are using an IDE and a variable has been removed from the script, then the IDE should prompt you that it doesn't exist if it is being used. In the notebook it's more difficult because all variables are stored in the same memory once they are created.

To handle it, just as a thought, if a cell contained a variable named foo, then when that cell is re-executed and foo is no longer declared, then remove foo from memory and provide UI feedback that is has been removed from memory. I'm sure there's other edge cases.

@StKyr
Copy link

StKyr commented Jun 10, 2021

I agree. Allowing variables that do not appear into the code to exist in memory can lead to an array of bugs since it is extremely likely for programmers to forget renaming some of instance of the old variable and Python will not raise a NameError which sounds very dangerous to me.

Perhaps this functionality could be added as an option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants