By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,387 Members | 1,709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,387 IT Pros & Developers. It's quick & easy.

stop script without exiting interpreter

P: 2
This is a continuation to an old post ( 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.

Alan Isaac"
Jun 17 '14 #1
Share this Question
Share on Google+
1 Reply

P: 2
Expand|Select|Wrap|Line Numbers
  1. from IPython import embed
  3. def f():
  4.     b=2
  5.     embed() # this stops execution and goes to the interpreter
  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.