> I want, and the script will stop executing at that line and will
> return to the interactive interpreter, as I wish.
May I recommend wrapping your main program in a function definition? Such
as:
main():
# Bulk of your code (use a macro to indent it faster)
if __name__ == "__main__":
"Alan Isaac" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Please note that this post has subject
> "stop script w/o exiting interpreter".
> Note that I can just put the undefined name ``stop`` on any line
> I want, and the script will
Please note that this post has subject
"stop script w/o exiting interpreter".
The object is to work at the *interactive* interpreter,
without leaving it.
Here is an example goal:
start a Python shell,
execfile a script,
exit the script at line 25,
and return to the Python shell.
Alan Isaac wrote:
> 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 des
Alan Isaac a écrit :
> 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?
If the point is to debug your script, then import pdb; pdb.set_trace()
Hello Alan,
> 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?
If you want to exit from the program then "raise SystemExit" is what
you want.
I
"Alan Isaac" <[EMAIL PROTECTED]> writes:
> 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?
If it's single threaded then just call sys.exit().
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 th