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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'restart': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'language.': 0.14; 'blocks': 0.16; 'commented': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mode,': 0.16; 'subject:top': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'thu,': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'assumes': 0.31; 'probably': 0.32; 'subject:the': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'nov': 0.38; 'bad': 0.39; 'users': 0.40; 'new': 0.61; 'entire': 0.61; 'choose': 0.64; 'to:none': 0.92; 'wanting': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=nF6KHKTT7Zu8C1m9B3kWaJ9LlTWsL+uM0BaIDdgH70A=; b=h5aOhyeJ83oHaK7ComeRYzTbLJqSKUOPajTFriZVj9x/g/estrIu8br7pNSz+r22ex YC4sEwCKfdHXhJHzQbL7iP8nz/vZC1gsPBOL9X6kuj6+xt/FWlyqU5u/qXZ3IYl/tTVI n/c5w+8s4QdW27rBdj1chCotc6YHO70vN8Jcu5CfNYqVaY+HSpOiOhohCGljpDNTF85H r1cExV2Muc0m3ljScD715nkY6Nz66wkiYJQOwN9g6JHwJI2OeiN7ywwR/U4kwSFnspH0 KPPQi4X7MkkQiu34B78wKVZkm3jJ48Gry3UpOX51d9XS/8V9AmxawqK3wZDTPVeFXDOn 0lHA==
MIME-Version 1.0
X-Received by 10.42.37.138 with SMTP id y10mr172352icd.26.1415814575111; Wed, 12 Nov 2014 09:49:35 -0800 (PST)
In-Reply-To <CANc-5UybJQu+QgUrL-kS4XUH5iQHHuWJfaqDu-y00PcvszY5PQ@mail.gmail.com>
References <CAPTjJmpVVfPzwrbeornk9Txyfiz+H5MDfHG2nY_9va7RCUEmEw@mail.gmail.com> <CAPTjJmrhz7crC2_x+ZN9sLgPvd8B1Yn8skzMSTBXJ6gSj55TqQ@mail.gmail.com> <CANc-5UybJQu+QgUrL-kS4XUH5iQHHuWJfaqDu-y00PcvszY5PQ@mail.gmail.com>
Date Thu, 13 Nov 2014 04:49:35 +1100
Subject Re: __missing__ for the top-level Python script
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15730.1415814578.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415814578 news.xs4all.nl 2959 [2001:888:2000:d::a6]:49387
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80614

Show key headers only | 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