Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: I love assert Date: Tue, 11 Nov 2014 21:43:45 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 20 Message-ID: References: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> NNTP-Posting-Host: 67-130-15-94.dia.static.qwest.net Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1415742225 17647 67.130.15.94 (11 Nov 2014 21:43:45 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 11 Nov 2014 21:43:45 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:80568 On 2014-11-11, Ben Finney wrote: > An ‘assert’ statement in the code will sometimes be active, and > sometimes be a no-op, for *exactly* the same code under different > circumstances. Yep, it's the same in C, C++, Java, PHP, and other languages. I think most people know that asserts can be disabled (either at run-time or compile time), and often are for performance reasons. > That's a trap for the reader, and I'd rather not set it. Personally, I find that too many asserts often makes code hard to read just because of the visual clutter and the veritical "spread" it induces. -- Grant Edwards grant.b.edwards Yow! I hope I bought the at right relish ... zzzzzzzzz gmail.com ...