[Python-Dev] a quit that actually quits (original) (raw)
Fredrik Lundh fredrik at pythonware.com
Wed Dec 28 08:56:14 CET 2005
- Previous message: [Python-Dev] a quit that actually quits
- Next message: [Python-Dev] a quit that actually quits
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ka-Ping Yee wrote:
Fredrik's NameError-based proposal (exit when there's an exception with no tbnext that says "name 'exit' is not defined") causes the interpreter to quit when you enter any expression involving 'exit'.
print exit # seems surprising [3, 4, 5, exit] # seems surprising 'a' in 'xyz' or exit # desirable or undesirable? del exit # actually happened to me x = exit # seems surprising
the easiest way to solve this that I can think of right now is to add a new sys variable that contains a copy of the most recent line read by the interactive prompt.
if sys.commandline.strip() in ("exit", "quit"):
sys.exit()
- Previous message: [Python-Dev] a quit that actually quits
- Next message: [Python-Dev] a quit that actually quits
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]