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