__missing__ for the top-level Python script

Chris Angelico rosuav at gmail.com
Wed Nov 12 18:49:35 CET 2014

On Thu, Nov 13, 2014 at 1:56 AM, Skip Montanaro
<skip.montanaro at gmail.com> wrote:
> sys.excepthook = autoload_exc
> I can't see a lot of people wanting this (I normally have its import
> commented out in my PYTHONSTARTUP file), and I think it would probably
> be bad practice for new users of the language.

Interesting data point there - that you actually have it handy and
choose not to use it. It's clearly designed for interactive mode, as
it assumes that it can restart entire blocks of code:

>>> for x in (1,2,3):
...  print x
...  if x==2: print os.pathsep
autoloading os

But that's about as good a "now go try this again" as will ever be
achieved with sys.excepthook, I expect.


More information about the Python-list mailing list