Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: I love assert Date: Fri, 14 Nov 2014 21:12:41 +0200 Organization: A noiseless patient Spider Lines: 21 Message-ID: <87ppcpmw9i.fsf@elektro.pacujo.net> References: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> <87a93wqeq3.fsf@elektro.pacujo.net> <5465e887$0$12976$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="5193"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/kwyfnz08klVI26wqsHOT" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:eFn1jnoZT9CtBd3//XvbyT0Kdu0= sha1:kxBeGuYgX6rY5DXONChrPH25d7Q= Xref: csiph.com comp.lang.python:80778 Ethan Furman : > My point being: a safety net that is so easily disabled does not count > (IMHO) as a backup. Correct. You never lean on assertions. They are primarily formal comments. However, assertion failures do help in troubleshooting occasionally. Most importantly, they immediately, unquestionably point the finger at the developer. > This is one my very few complaints about Python: running it normally > is the same as running with DEBUG turned on, so the unusual case is > remembering to run with asserts turned /off/. I don't remember ever having optimized them out in any programming language. Has that really improved the performance of your code? Marko