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)
5
Downside is you have to use the module, `from mymodule import function` won't reload.
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.