468,537 Members | 1,555 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,537 developers. It's quick & easy.

Returning values from function to Python shell/IPython

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 my_module.py`, 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
Mar 9 '08 #1
0 785

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Carl | last post: by
11 posts views Thread by ronan_boisard | last post: by
30 posts views Thread by bblais | last post: by
2 posts views Thread by Bo Peng | last post: by
16 posts views Thread by John Salerno | last post: by
7 posts views Thread by Frank Potter | last post: by
3 posts views Thread by R. Bernstein | last post: by
7 posts views Thread by Michele Simionato | last post: by
reply views Thread by Python Nutter | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.