[IPython-dev] Two basic Notebook questions (Python focus)
takowl at gmail.com
Fri Jan 30 18:48:59 EST 2015
On 30 January 2015 at 15:26, Jean Bigboute <jeanbigboute at gmail.com> wrote:
> b) Is it possible to pass arguments to a magic function?
> import inspect
> print inspect.getsource(function)
This is probably easiest to do in a plain Python function. Create a file
~/.ipython/profile_default/startup/printsource.py (which IPython will
automatically run when it starts, and put in it:
Now you can just type 'source(f)' to see a function in your notebook. Be
aware, though, that if you share that notebook, other people won't have the
source() function defined. You could also define it at the top of the
notebook if you prefer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev