[Tutor] printing out the definition of a func

Lloyd Kvam pythontutor@venix.com
Thu, 20 Dec 2001 08:56:01 -0500


I am pretty sure that you are asking too much.  Even in text mode,
you should be able to switch between different sessions.  Keep one
session in your editor window where the source file is visible.
Then have a Python session.  Use:
import FILENAME		- the first time
reload(FILENAME) 
- later times
to get the latest changes from the source file.  Rember to save to
the disk from your editor.

So far as I know, all Linux distributions use <Alt-FunctionKey> to
switch between sessions.

lonetwin wrote:

> 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
> 


-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice: 
603-443-6155
fax: 
801-459-9582