Returning values from function to Python shell/IPython

Karlo Lozovina _karlo_ at
Sun Mar 9 16:56:14 CET 2008

Hi all! 

I have a runTest() function inside my module, which sets up and initializes
lots of objects and performs some basic tests on them. Usually (from
IPython) I just write `run`, and then `runTest()`. But
sometimes I would like to manually twiddle with objects runTest creates. Is
there any way I can "return" all those objects local to runTest(), and have
them available in IPython (or ordinary Python shell)?


I know I can do it from a:

if __name__ == '__main__':
  # lots of object initialization...

and then have all those objects available in the interpreter.

Karlo Lozovina -- Mosor

More information about the Python-list mailing list