iPython clear cache from within function call?
I am having memory issues with iPython, and I find that calling %clear out
occasionally clears this out. It seems to be caching output somewhere within some of the functions that I'm calling.
I would like to build this into my function. clear out
calls:
self.outputcache.flush()
How can I get a refere开发者_运维百科nce to the iPython shell (self
in the above)? In other words: how can I flush the outputcache in iPython, without using clear
?
The output cache is Out
or _oh
in your user namespace, so you can call Out.clear()
. Edit: This might be a different output cache to self.outputcache
. I'm not so familiar with 0.10.
If you need a reference to your IPython shell, in IPython 0.10, use __IP
or __IPYTHON__
. In 0.11 (the development version), use get_ipython()
.
精彩评论