Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.05; 'run- time': 0.05; 'interpreter.': 0.07; 'expression:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'variations': 0.16; 'wrote:': 0.18; 'pointed': 0.19; "python's": 0.19; 'header :User-Agent:1': 0.23; 'options': 0.25; 'equivalent': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'raise': 0.29; 'statement': 0.30; 'disabled': 0.31; 'writes:': 0.31; 'option': 0.32; 'run': 0.32; 'quite': 0.32; 'ben': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'matter': 0.61; 'different': 0.65; 'love': 0.65; 'bare': 0.84; 'received:fios.verizon.net': 0.84; 'seldom': 0.84; 'proposition': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: I love assert Date: Wed, 12 Nov 2014 03:29:13 -0500 References: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> <857fz173ko.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-108-16-203-145.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <857fz173ko.fsf@benfinney.id.au> 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415780974 news.xs4all.nl 2965 [2001:888:2000:d::a6]:44323 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80594 On 11/11/2014 5:52 PM, Ben Finney wrote: > Terry Reedy writes: > >> We love 'assert' so much that we have 20-30 'assertXYZ' variations in >> unittest. > > A function will not be disabled by a run-time option to the Python > interpreter. > >> The statement 'assert expression' is almost equivalent to >> >> if not expression: raise AssertionError('expression') > > With the important difference that this will be active no matter what > options Python's interpreter is run with. That makes it quite a > different proposition from using =E2=80=98assert=E2=80=99 statements. Which importand difference I pointed out (and you snipped) as a reason=20 to seldom use bare assert. --=20 Terry Jan Reedy