Hacker News new | ask | show | jobs
by bee_rider 1270 days 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

1 comments

You 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