7 ms·
ipython has a killer autoreload function: http://ipython.org/ipython-doc/stable/config/extensions/autoreload.html#module-IPython.extensions.autoreload http://ip
by Xephyrous 11y ago
ipython has a killer autoreload function: http://ipython.org/ipython-doc/stable/config/extensions/autoreload.html#module-IPython.extensions.autoreload http://ipython.org/ipython-doc/stable/config/extensions/auto...
In [1]: %load_ext autoreload
In [2]: %autoreload 2
In [3]: from foo import some_function
In [4]: some_function()
Out[4]: 42
In [5]: # open foo.py in an editor and change some_function to return 43
In [6]: some_function()
Out[6]: 43
It's nothing like a proper lisp repl, but you can sorta do this in vanilla python too, if you don't mind some annoyances.
`reload` reloads a module:
>>> import mymodule
>>> print mymodule.myfunction()
3
>>> reload(mymodule)
>>> print mymodule.myfunction()
5
Downside is you have to use the module, `from mymodule import function` won't reload.
- gknoy 11y agoThanks a TON! I am Frequently Slightly Annoyed by pressing control-. and having to re-import things, declare things, etc. I'm looking forward to using this.