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: 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: <87liiyr48f.fsf@handshake.de> <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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sat, Jul 14, 2012 at 3:08 AM, Prasad, Ramit 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