2 ms·
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
by bee_rider 4y ago
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 https://stackoverflow.com/questions/10367414/delete-function
- saila 4y agoYou can delete references to any object in Python, including functions: >>> 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 https://news.ycombinator.com/item?id=34197904