[Python-Dev] a quit that actually quits
skip@pobox.com
skip at pobox.com
Wed Dec 28 14:08:12 CET 2005
Fredrik> if isinstance(exc_value, NameError) and not exc_info.tb_next:
Fredrik> text = exc_value[0]
Fredrik> name = ... extract name from nameerror string ...
Fredrik> if sys.commandline.strip() == name:
Fredrik> if name in ("exit", "quit"):
Fredrik> raise SystemExit
Fredrik> if name == "help":
Fredrik> help()
Fredrik> return
Fredrik> ...
Fredrik> any suggestions on how to improve this ?
I'd make it sys._last_input or something similar to make it clear that a)
this is magic, don't mess with it, and that b) this is the last user input,
not the raw command line.
Skip
More information about the Python-Dev
mailing list