Path: csiph.com!usenet.pasdenom.info!gegeweb.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'tests.': 0.07; 'occasionally': 0.09; 'statements': 0.09; '(both': 0.16; '-tkc': 0.16; 'fond': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'hasattr(obj,': 0.16; 'pythonistas': 0.16; 'received:10.216': 0.16; 'wrote:': 0.18; 'typing': 0.19; "aren't": 0.24; 'tend': 0.24; 'header:In-Reply-To:1': 0.27; 'along': 0.30; "i'm": 0.30; 'lines': 0.31; 'assert': 0.31; 'actual': 0.34; 'common': 0.35; 'something': 0.35; 'impression': 0.36; 'charset:us-ascii': 0.36; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'catch': 0.60; 'most': 0.60; 'am.': 0.91 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1415746842713:2900424340 X-MC-Ingress-Time: 1415746842713 Date: Tue, 11 Nov 2014 17:03:26 -0600 From: Tim Chase To: python-list@python.org Subject: Re: I love assert In-Reply-To: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> References: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415746853 news.xs4all.nl 2853 [2001:888:2000:d::a6]:47638 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80574 On 2014-11-11 11:40, Peter Cacioppi wrote: > I get the impression that most Pythonistas aren't as habituated > with assert statements as I am. Is that just a misimpression on my > part? I tend to use it to catch my bone-headedness rather than actual tests. I'm particularly fond of one that catches me typing "obj.exceptions" rather than "obj.exemptions" (both are common and occasionally interchangeable terms in $DAYJOB) something along the lines of assert hasattr(obj, "exceptions"), "idiot programmer" -tkc