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


Groups > comp.lang.python > #25273

RE: adding a simulation mode

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'interpreter': 0.04; 'removes': 0.05; 'arguments': 0.07; 'completeness': 0.07; 'exception.': 0.07; 'subject:adding': 0.07; 'suppose': 0.07; 'interpreter,': 0.09; 'received:155': 0.09; '"right"': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:155.180.234': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'to:name:python- list@python.org': 0.20; 'trying': 0.21; 'do.': 0.21; 'stopping': 0.22; 'trace': 0.22; 'mention': 0.23; 'third-party': 0.23; 'received:169.254': 0.24; 'header:In-Reply-To:1': 0.25; 'accuracy': 0.27; '"in': 0.29; 'catching': 0.29; 'received:169': 0.29; '(including': 0.30; 'usually': 0.30; 'function': 0.30; 'header:Received:8': 0.30; 'code': 0.31; 'print': 0.32; 'raising': 0.33; 'to:addr:python-list': 0.33; 'me?': 0.33; 'agree': 0.34; 'wrong': 0.34; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'your': 0.60; 'kind': 0.61; 'back': 0.62; 'production': 0.63; 'skip:n 10': 0.63; 'information': 0.63; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'experience.': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'received:169.254.8': 0.84; 'subject:mode': 0.84; 'hassle': 0.91
X-DKIM OpenDKIM Filter v2.1.3 sz2.jpmchase.com q6DH8VCW025357
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1342199311; bh=mOcOM2s/QKKBL4Bt1laBVWglfaq6mXgl6/Myu58D8dQ=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=VkF4bORMA4tR2V9lzVJ8PRmL1bty06ffL4Hd77VX37vAK8ZxqhLxkxv1l175CnF0A 6Wdul66PYbnaqXQEBc+7rtRUhPTkrBAB2ttCqY3n+uAob25fMxjvwLw28BT4OFNqxO faf9Y438H49kdyf0Jd7ku2FBNv9iAY5NC/i6etFI=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To "python-list@python.org" <python-list@python.org>
Subject RE: adding a simulation mode
Thread-Topic adding a simulation mode
Thread-Index AQHNYJ2RvIEMWnlORUqA95TdxMRilpcnrFMA///E5NA=
Date Fri, 13 Jul 2012 17:08:16 +0000
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>
In-Reply-To <50004de0$0$6876$e4fe514c@news2.news.xs4all.nl>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.67.79.47]
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-DLP-FWD Yes
Content-Type text/plain; charset="us-ascii"
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.2088.1342199320.4697.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342199320 news.xs4all.nl 6972 [2001:888:2000:d::a6]:40098
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25273

Show key headers only | View raw


> > Please do NOT catch BaseException, since that is the wrong thing to do.
> 
> I would agree if you had said "in production code".
> 
> If you are investigating why a third-party function is stopping your
> interpreter, then catching BaseException may tell you that the code
> is raising the wrong kind of Exception.  Once you know what kind the
> function is raising, you should catch only that particular excpetion
> subclass.

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. Why bother with trying to catch and 
print something when the interpreter will do it for me? Not
to mention that removes any hassle of trying to catch the
"right" exception or figuring out the best way to print it.
I suppose if there are arguments on the exception that were not
printed then I might want to catch it, but has been rare
in my experience.

Ramit

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

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