exit to interpreter?

Steven W. Orr steveo at syslang.net
Tue Mar 27 11:17:43 EDT 2007


On Friday, Mar 23rd 2007 at 10:52 -0700, quoth belinda thom:

=>I'm writing a function that polls the user for keyboard input,  
=>looping until it has determined that the user has entered a valid  
=>string of characters, in which case it returns that string so it can  
=>be processed up the call stack. My problem is this. I'd also like it  
=>to handle a special string (e.g. 'quit'), in which case control  
=>should return to the Python command line as opposed to returning the  
=>string up the call stack.
=>
=>sys.exit seemed like a good choice, but it exits the python interpreter.
=>
=>I could use an exception for this purpose, but was wondering if  
=>there's a better way?

I was reading other people's responses. Why not simply use the python 
debugger?

http://docs.python.org/lib/module-pdb.html

Yes? No?

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



More information about the Python-list mailing list