I mean, it is Python, if you are using it you aren’t aiming to be super-lean, right?
Apparently it is possible to delete a function.
https://stackoverflow.com/questions/10367414/delete-function
Apparently it is possible to delete a function.
https://stackoverflow.com/questions/10367414/delete-function
>>> def f(): None
...
>>> del f
but it's pointless to try to manually manage memory in Python in most cases. If you're processing huge amounts of data, there are probably better approaches than using `del` and/or `gc.collect()` to keep memory usage down (like batching and/or using subprocesses).My other comment in this thread is relevant too: https://news.ycombinator.com/item?id=34197904