Mswp, a Python decorator that clears local variables upon function execution
github.com
github.com
You can install mswp via pip: pip3 install mswp
To use mswp, simply decorate your functions with @mswp. This ensures that any temporary local variables used within the function are cleared upon completion, promoting code cleanliness and efficient memory usage.
from mswp import clear
@clear def my_function(): temp_var = 10 # Your code here return result
Features - Automatic Cleanup: mswp automatically clears temporary local variables after function execution, preventing clutter and potential memory leaks. - Simplified Syntax: With a simple decorator, mswp streamlines code maintenance and promotes readability. - Error Handling: mswp provides robust error handling to ensure reliable execution even in the presence of exceptions.