<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 30 January 2015 at 15:26, Jean Bigboute <span dir="ltr"><<a href="mailto:jeanbigboute@gmail.com" target="_blank">jeanbigboute@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":2w5" class="a3s" style="overflow:hidden">b) Is it possible to pass arguments to a magic function?<br>
e.g.<br>
import inspect<br>
print inspect.getsource(function)</div></blockquote></div><br></div><div class="gmail_extra">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:<br><br></div><div class="gmail_extra">import inspect<br></div><div class="gmail_extra">def source(func)<br></div><div class="gmail_extra">    print inspect.getsource(function)<br><br></div><div class="gmail_extra">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.<br><br>Thomas<br></div></div>