Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80614

Re: __missing__ for the top-level Python script

References <CAPTjJmpVVfPzwrbeornk9Txyfiz+H5MDfHG2nY_9va7RCUEmEw@mail.gmail.com> <CAPTjJmrhz7crC2_x+ZN9sLgPvd8B1Yn8skzMSTBXJ6gSj55TqQ@mail.gmail.com> <CANc-5UybJQu+QgUrL-kS4XUH5iQHHuWJfaqDu-y00PcvszY5PQ@mail.gmail.com>
Date 2014-11-13 04:49 +1100
Subject Re: __missing__ for the top-level Python script
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15730.1415814578.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Nov 13, 2014 at 1:56 AM, Skip Montanaro
<skip.montanaro@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
...
1
2
autoloading os
1
2
:
3

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

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: __missing__ for the top-level Python script Chris Angelico <rosuav@gmail.com> - 2014-11-13 04:49 +1100

csiph-web