X-Received: by 10.182.58.105 with SMTP id p9mr7354957obq.25.1415734838847; Tue, 11 Nov 2014 11:40:38 -0800 (PST) X-Received: by 10.50.142.105 with SMTP id rv9mr386343igb.0.1415734838762; Tue, 11 Nov 2014 11:40:38 -0800 (PST) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!r10no1557170igi.0!news-out.google.com!ks2ni14902igb.0!nntp.google.com!r10no1557166igi.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Tue, 11 Nov 2014 11:40:38 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:7:0:aa4:60d4:a10:805e:4133; posting-account=WnQ31woAAAD53hPo6qPShawacgs0_foq NNTP-Posting-Host: 2601:7:0:aa4:60d4:a10:805e:4133 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> Subject: I love assert From: Peter Cacioppi Injection-Date: Tue, 11 Nov 2014 19:40:38 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.python:80553 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 th= ere 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 s= ubstitute for unit tests, it doesn't absolve you of normal exception respon= sibilities, 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 "act= ive comments".