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


Groups > comp.lang.python > #25275

Re: adding a simulation mode

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!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.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'exception': 0.03; 'handler': 0.04; 'interpreter': 0.04; 'socket': 0.05; 'parser': 0.07; 'subject:adding': 0.07; 'accepts': 0.09; 'sat,': 0.15; 'client,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.17; 'instance,': 0.17; 'otherwise,': 0.20; 'received:209.85.214.174': 0.21; 'trace': 0.22; 'command': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'handling': 0.27; 'possibly': 0.27; 'execution': 0.27; 'message- id:@mail.gmail.com': 0.27; 'catching': 0.29; 'maybe': 0.29; '(including': 0.30; 'connection': 0.30; 'usually': 0.30; 'code': 0.31; 'print': 0.32; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'server': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'bad': 0.37; 'one,': 0.37; 'two': 0.37; '(for': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'unit': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'back': 0.62; 'production': 0.63; 'skip:n 10': 0.63; 'information': 0.63; 'jul': 0.65; 'matter.': 0.65; 'subject:mode': 0.84; 'production,': 0.91; 'that),': 0.91
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:to :content-type; bh=hwI4AU7pLJgwHRBywW/bvRZlLH5tDuazg6Djg5PZ+cA=; b=fWx0TVSPb1yc2J7+uIrwwLkz2q8MzXPh6Xw7/yVeZ+ArMeNguRZwANedHV3MVW5r2o DFE7tzEPMLmsyEWfyim/PjTXt7U6hhikV2Xhi0LFsj59rzGxS2zptapoXEupKiOuvnFb GwplLXxajeIn0OCn6GEV5r307mo1bnAtjRF4WNnZ3FGJ968tmIOppwcffJPNUsEJ/6nT lazxVUvr/BCtRB/M2ag5vVOveRu6jS+8p9zBEpWPsqi7NetaB9YTAoUyWyzBm18KM/IN FmIOeRz+QdCrd6SlAIbuwGLmcMM0raPORXsBEmga6XIjkrrL8QYqovNPxnyzLRcD1UUg ilaw==
MIME-Version 1.0
In-Reply-To <5B80DD153D7D744689F57F4FB69AF47416556225@SCACMX008.exchad.jpmchase.net>
References <CAF_E5JbFK4ZYsvwdVHxw-S7vLkpwskF=OCohWW2okmPi56ObOA@mail.gmail.com> <87liiyr48f.fsf@handshake.de> <CAF_E5JaUD-AyudMut00Bjjan0Zv767do=XM_zKS3DvBmC4reyQ@mail.gmail.com> <mailman.2039.1342099220.4697.python-list@python.org> <jtml37$bf3$1@reader1.panix.com> <mailman.2043.1342102625.4697.python-list@python.org> <jtmpd7$r1j$1@reader1.panix.com> <mailman.2044.1342107465.4697.python-list@python.org> <4fff8514$0$29965$c3e8da3$5496439d@news.astraweb.com> <50004de0$0$6876$e4fe514c@news2.news.xs4all.nl> <5B80DD153D7D744689F57F4FB69AF47416556225@SCACMX008.exchad.jpmchase.net>
Date Sat, 14 Jul 2012 03:24:13 +1000
Subject Re: adding a simulation mode
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2090.1342200258.4697.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342200258 news.xs4all.nl 6880 [2001:888:2000:d::a6]:47935
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25275

Show key headers only | View raw


On Sat, Jul 14, 2012 at 3:08 AM, Prasad, Ramit
<ramit.prasad@jpmorgan.com> wrote:
> I would say the opposite. In production code usually I want it
> to recover, log as much information as I need (including sending
> any notifications), and NOT just die.
>
> In development, not catching the exception will give me a full
> trace back automatically.

Here's another take on the matter. In development, your script is your
execution unit, so you let the interpreter print out your tracebacks.
In production, there will usually be one, maybe two subunits (for
instance, a TCP-based server might have the socket connection as an
execution unit, and possibly a command parser inside that), and at the
top of that subunit, you have a broad exception handler that resets
that one unit (goes back and accepts another client, or waits for
another command). Otherwise, wide-scope exception handling is usually
a bad thing.

ChrisA

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


Thread

Re: adding a simulation mode andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-12 14:20 +0100
  Re: adding a simulation mode John Gordon <gordon@panix.com> - 2012-07-12 13:56 +0000
    Re: adding a simulation mode andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-12 15:17 +0100
      Re: adding a simulation mode John Gordon <gordon@panix.com> - 2012-07-12 15:10 +0000
        Re: adding a simulation mode andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-12 16:37 +0100
          Re: adding a simulation mode Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-13 02:16 +0000
            Re: adding a simulation mode Hans Mulder <hansmu@xs4all.nl> - 2012-07-13 18:33 +0200
              RE: adding a simulation mode "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-13 17:08 +0000
              Re: adding a simulation mode Chris Angelico <rosuav@gmail.com> - 2012-07-14 03:24 +1000
      Re: adding a simulation mode Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-13 02:09 +0000
  Re: adding a simulation mode Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-13 02:37 +0000
    Re: adding a simulation mode andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-13 09:54 +0100

csiph-web