[Tutor] printing out the definition of a func

lonetwin lonetwin@yahoo.com
Thu, 20 Dec 2001 17:08:41 +0530


Hi everybody,
     A quick question, can I print out the definition of a func/class *after* 
I have defined it, in the python intepreter ??? ....it'd be nice to be able 
to do this 'cos I seem to need it pretty often (for debugging stuff)....and 
no, I do not use IDLE, 'cos I work at command prompt (under linux) and 
fire-up the intepreter there (X *crawls* on my system).

In other words, I want to:
===================================================
[steve@mercury ~]$ python
Python 2.0 (#1, Apr 11 2001, 19:18:08) 
[GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux-i386
Type "copyright", "credits" or "license" for more information.
>>> def func(foo):
            .......
            .......
            .......
>>> doStuff()
>>> doSomeMore()
>>> ........
>>> ........
<at this point the definition of func() has scrolled up>
>>> print code(func) <----------- Could someone prolly show me how to write
                                                             this function ???
===================================================
.....or am I asking for too much ??

Peace
Steve
-- 
----------------------------------------------
I get up each morning, gather my wits.
Pick up the paper, read the obits.
If I'm not there I know I'm not dead.
So I eat a good breakfast and go back to bed.

Oh, how do I know my youth is all spent?
My get-up-and-go has got-up-and-went.
But in spite of it all, I'm able to grin,
And think of the places my get-up has been.
                -- Pete Seeger
----------------------------------------------