[Python-Dev] a quit that actually quits
Fredrik Lundh
fredrik at pythonware.com
Wed Dec 28 11:04:55 CET 2005
Martin v. Löwis wrote:
> > In short, I think it makes a lot of sense to support a bare "exit" and/or
> > "quit" as a completely intuitive platform-independent newbie-friendly way to
> > exit the interpreter.
>
> I can readily agree to this part of Fredrik's proposal. What slightly
> bothers me is the hackish nature of the proposed implementation.
here's my current proposal (see ping's post and my reply for background):
if isinstance(exc_value, NameError) and not exc_info.tb_next:
text = exc_value[0]
name = ... extract name from nameerror string ...
if sys.commandline.strip() == name:
if name in ("exit", "quit"):
raise SystemExit
if name == "help":
help()
return
...
any suggestions on how to improve this ?
</F>
More information about the Python-Dev
mailing list