467,889 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

stop script without exiting interpreter

This is a continuation to an old post (http://bytes.com/topic/python/answer...ng-interpreter) that I think a found a better answer.

The question was:
"I'm fairly new to Python and I've lately been running a script at
the interpreter while working on it. Sometimes I only want to
run the first quarter or half etc. What is the "good" way to do this?

Possible ugly hacks include:

- stick an undefined name at the desired stop point
- comment out the last half

I do not like these and assume that I have overlooked the obvious.

Thanks,
Alan Isaac"
Jun 17 '14 #1
  • viewed: 1232
Share:
1 Reply
Expand|Select|Wrap|Line Numbers
  1. from IPython import embed
  2.  
  3. def f():
  4.     b=2
  5.     embed() # this stops execution and goes to the interpreter
  6.  
  7. print 'oi'
  8. a=1
  9. f()
Jun 17 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Timo-Pekka Oikarinen | last post: by
2 posts views Thread by Hal Vaughan | last post: by
6 posts views Thread by keyser_Soze | last post: by
reply views Thread by Dirk Runge | last post: by
2 posts views Thread by Ruben | last post: by
6 posts views Thread by Alan Isaac | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.