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


Groups > comp.lang.python > #103743

Re: usage of try except for review.

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: usage of try except for review.
Date Tue, 1 Mar 2016 04:38:20 +1100
Lines 14
Message-ID <mailman.31.1456767509.20602.python-list@python.org> (permalink)
References <CACT3xuWm56OE7LpR8kBLfWfkDoU18sPcN5DRiXjr=68+Kywo8Q@mail.gmail.com> <CACT3xuXA=xy8ovTQOS9Bz06P0R1FjQ=bN4-3Pxqf3Cu7wN1dXg@mail.gmail.com> <c5r8dbplpbr62lca859i5cs5dlskfdqeuu@4ax.com> <CACT3xuXC8ZxTd6E-giB9xEJvikQ76o62a5TKrZsQmqZgQtjLsw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de b0RsvYB1sedSJ0fBCHLe1gMCe0dwVvG8GEZo3J/WapKA==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; '"no"': 0.07; 'correct.': 0.07; 'cc:addr:python-list': 0.09; 'assume': 0.11; '"assert"': 0.16; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:usage': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'meant': 0.22; 'am,': 0.23; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'message-id:@mail.gmail.com': 0.27; 'work.': 0.30; 'tue,': 0.34; 'received:google.com': 0.35; 'replaced': 0.35; 'should': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'no,': 0.38; 'received:209': 0.38; 'still': 0.40; 'your': 0.60; 'mar': 0.65; 'potentially': 0.67; 'chrisa': 0.84; 'subject:try': 0.84; 'to:none': 0.91; 'dennis': 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:cc; bh=vMQc++MGR1hqfJzVd5RXtHWofbaxG4zdYE/3vHCxraA=; b=wSDbAc/zU5iBHT2IKJ8OPmAE9dN9YKLX75og4cd2Rjlm0TylesBWDpD+vS03wD6s4o 1y7xAmDhRZnZNTYoX1uJHcHGD3oHT7S5RGVkSoef3n9C4nt+N9QzEQ7If3vDAl2DM8g9 gDamCLubxg0Gbd1XP1S5ACH6httf3yPcGDsnMiR++3nza0LVmog6oLNcx14ZdPXLtB2Z T84wRpjTI5NfQq9+4SK9YMSbTUB2m+fh+7tdT/I3WaKkCQWBDM2Qtn82GQ36EzJf1yRM xExp6WAT7DZitGG9SsmjeJGZjgoGf7NNVrRIOcLtmJwrakdlBCM3sSs3JM6cf4Pdw7tm iIwg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=vMQc++MGR1hqfJzVd5RXtHWofbaxG4zdYE/3vHCxraA=; b=KwBOLhsqNxkBjo6uyz5VzTsJF9ejGI1FZEh/NlXCQZwQCdLuFCAfm7Yr9hT1lJhwLk VgWsod7w9/vl7jnojKxKm4IpCQl8xPFeGflph5z+jnJV945zL7g6AqSTdqCJyKNK+XJT HutQNeM0tq+kjVDZPhCa6BtUNr01ZSnhyeSq+hyRspkm/hTX9N6VrVWIXFm2Une+T1/M WMfuNXWcbH9jbiNYGo3UDJN2rjPdKkXYpXZ74iQtpIjD+cfHRhPo1m0eRvTyBwFFFi8k 8M0T1wdocBEgQZkPzz1qPy5cLxXxru682998ODMKZyK8rDKrf19AOuBWP+mt8VeSSLDV 6n9g==
X-Gm-Message-State AD7BkJJWHpo2XilC8AWPlPbPx6XnygfVwlU49BTzh1dLupTLODKRYYTdAiM/bYzLF6QjZtL9CATzUjgNkJvjnw==
X-Received by 10.107.47.163 with SMTP id v35mr6042473iov.19.1456767500220; Mon, 29 Feb 2016 09:38:20 -0800 (PST)
In-Reply-To <CACT3xuXC8ZxTd6E-giB9xEJvikQ76o62a5TKrZsQmqZgQtjLsw@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
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>
Xref csiph.com comp.lang.python:103743

Show key headers only | View raw


On Tue, Mar 1, 2016 at 4:34 AM, Ganesh Pal <ganesh1pal@gmail.com> wrote:
> On Mon, Feb 29, 2016 at 10:10 PM, Dennis Lee Bieber
> <wlfraed@ix.netcom.com> wrote:
>
>>         Ask yourself: Will my program still work if I remove all the assert
>> statements. If the answer is "No", then you should not be using an assert.
>
> You meant if the answer is "NO" then I should be using asset ?

No, Dennis was correct. You should assume that "assert" can
potentially be replaced with "pass" and your program will continue to
work.

ChrisA

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


Thread

Re: usage of try except for review. Chris Angelico <rosuav@gmail.com> - 2016-03-01 04:38 +1100
  Re: usage of try except for review. Steven D'Aprano <steve@pearwood.info> - 2016-03-01 23:05 +1100

csiph-web