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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to