How to see the code definiton in the shell ?
Matias Surdi
matiassurdi at gmail.com
Wed May 13 13:00:01 EDT 2009
Mohan Parthasarathy escribió:
> Hi,
>
> I am new to Python. I tried searching this but could not find an answer.
> In the interactive shell, I write a new function and I want to be able
> to see all the code that I wrote at a later time. Just typing the
> function name only shows
>
> >>> allmethods
> <function allmethods at 0x822b0>
>
> How do I see the actual code ?
>
> thanks
> mohan
>
I think that is not possible (at least, not with the default python
console and without doing introspection).
Anyway, why you need to do that? Why not write down the script in a text
file and run it?
If you need to "run a console" inside a function so that you can inspect
variables, maybe you can use:
import pdb;pdb.set_trace()
And that will start a debug session when gets executed.
Hope that helps.
More information about the Python-list
mailing list