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


Groups > comp.lang.python > #80564

Re: I love assert

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63
Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!news.muarf.org!news.ecp.fr!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <fomcl@yahoo.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.141
X-Spam-Level *
X-Spam-Evidence '*H*': 0.72; '*S*': 0.00; 'tool,': 0.07; 'statements': 0.09; 'tests,': 0.09; 'python': 0.11; 'cleaner': 0.16; 'intended.': 0.16; 'pythonistas': 0.16; 'substitute': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'not,': 0.20; 'coding': 0.22; 'tests': 0.22; 'to:name:python-list@python.org': 0.22; "aren't": 0.24; 'package.': 0.24; 'removed.': 0.24; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'tried': 0.27; 'am,': 0.29; "doesn't": 0.30; 'assert': 0.31; 'probably': 0.32; 'run': 0.32; '-----': 0.33; 'basic': 0.35; 'but': 0.35; 'there': 0.35; 'impression': 0.36; 'useful': 0.36; 'should': 0.36; 'unit': 0.37; 'email addr:python.org': 0.37; 'easily': 0.37; 'to:addr:python-list': 0.38; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'received:67.195': 0.60; 'received:98.137': 0.60; 'truly': 0.60; 'most': 0.60; 're:': 0.63; 'love': 0.65; 'email name:python-list': 0.65; 'specialized': 0.65; 'header:Reply-To:1': 0.67; 'received:gq1.yahoo.com': 0.68; 'received:mail.gq1.yahoo.com': 0.68; '"active': 0.84; 'action.': 0.84; 'actually,': 0.84; 'ethan': 0.84; 'furman': 0.84; 'received:bullet.mail.gq1.yahoo.com': 0.84; 'am.': 0.91; 'passive': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1415740336; bh=WUj04Esn3/SOECEkulafemM6BHKqA1F5zxLINTh925g=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=CWCUjAwooBEl4c5HGndAUZ0ErMp+IytlzWVvLrxVA7d9OpiYmrNKJ4vKu7WUMp9+bTBI4n5DmlICo9/BQggXi0N5c0A1guKitu0kr2LKwlrPburNVTy6jaH5Wm42akr8gX3d2qnVCcNGmnu1nn2+yMEhIfX8f41dDQutAfBnfLse2MppDhBNzSuHTHo62URKpcDmmsk87jw9dVz1nQDnbfbFVASCr+rwPy04JeHGLiLe6rWNXRDsnjG8GV7UPrglfHN9npNaCesRyniOpm32iRBji2TdSypNym0BfNzZNeRok4Jsc/uKNY3gPH57W0xO0MjUFzFM8M81L6sWoFLLPw==
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=OZNkOYbynEru5cr3gjWXlEyu/SbKi1d/L65nfYxV6WquoymiwZPam2a8s9RuO4Pl8ViRqMtqUgo8C9h4PMoukk+JQAdDTse/aUb4YVugpTNVncx4rRsiH/Yr9vrm5qaCbIHWUz8OIyNcz6E1a0h585qKHN8xdAg246a+4Bw/PJeGxG7K1hNPaWPSrYbiYgR8nAlSpn7KsMNAvOuiYBcNdnQPoBO9yDeKFTFjYqB7r6G9IeuvbtdwLMaP68zbV9AztOpOveMrQbrObfcLJQ2EZaFe2arybl007xah+HZit4W4rzO/SsYWjlGozpWppK4mY1v0l/sCEgyIgj+Ti0F2Dg==;
X-Yahoo-Newman-Property ymail-4
X-Yahoo-Newman-Id 263986.85484.bm@omp1010.mail.gq1.yahoo.com
X-YMail-OSG vz0sNksVM1kfA0lRVdp0c.2pVSpYeIcycAR183FZhR1H7itAJvtfqQvPSlZhGxx YF7FXF_m8w7OdS1jpGCITcI6IxpWhm5gng9NNccqq7qKzi3I7ksR8c_LZ_3Sj2T0xOQ8ppPhHMhc IU9slMd3MO11gTtRQBpQPE6JSBeMHzGiPdDelxC5q0BtInCMlQj3Mjv_tma48RsadydhNdBhmNKD 8dQN6kk14i95Y1EO6OL_905w_3mbcCCckOJ8o7RemVZmd9RioMkbfGcff8pHlRF4gPQVV.VPAMY4 RQF7rhv5rcj1GXVLLf83PJH_a3jwxv7uA0SRN4dZPY2TkbA2R_CBIOSx53Kf4FvslfIcQK9iOHDE TV2DRFDJICHQ8uj5GD41..dlRO2L49mLXjBWCoQBWICSbMC8ci_ixZP3i8K.lkE9Nmk6dAQ515fE tJyu__CCEc9NeUFajyacDGMx_0ws8Vy5FVXpIjCFeqP295csMNKedr9F5_TtkXIMHfaDYm0ftuVA mKdK.0XSqvM9yCg--
Date Tue, 11 Nov 2014 21:09:16 +0000 (UTC)
From Albert-Jan Roskam <fomcl@yahoo.com>
To Ethan Furman <ethan@stoneleaf.us>, "python-list@python.org" <python-list@python.org>
In-Reply-To <54626CB0.5080405@stoneleaf.us>
References <54626CB0.5080405@stoneleaf.us>
Subject Re: I love assert
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To Albert-Jan Roskam <fomcl@yahoo.com>
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>
Newsgroups comp.lang.python
Message-ID <mailman.15692.1415740487.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415740488 news.xs4all.nl 2882 [2001:888:2000:d::a6]:43246
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80564

Show key headers only | View raw



----- Original Message -----

> From: Ethan Furman <ethan@stoneleaf.us>
> To: python-list@python.org
> Cc: 
> Sent: Tuesday, November 11, 2014 9:08 PM
> Subject: Re: I love assert
> 
> On 11/11/2014 11:40 AM, 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? If not, is there a good 
> reason to
>>   assert less with Python than other languages?
>> 
>>  As far as I can tell, Python supports assert perfectly well. When run with 
> the optimization
>>   flagging, the asserts are truly removed.
>> 
>>  I think one needs to take care with some basic assert coding - it's not 
> a substitute for
>>   unit tests, it doesn't absolve you of normal exception 
> responsibilities, and, most of all,
>>   it should be used for passive inspection and not action. But given these 
> guidelines, I
>>   still find it very useful as "active comments".
> 
> asserts are a specialized tool, easily abused.  Sounds like you are using them 
> exactly as intended.


Would you say that assert is baaadly abused in nose?*) I never tried it, but probably all tests pass when Python is run with -O or -OO.

*) Actually, I love that package. Much cleaner than unittest.

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


Thread

Re: I love assert Albert-Jan Roskam <fomcl@yahoo.com> - 2014-11-11 21:09 +0000

csiph-web