Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59838
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <robertkday@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.047 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.00; 'debug': 0.07; 'run,': 0.09; 'bug': 0.12; 'before.': 0.16; 'buggy': 0.16; 'called,': 0.16; 'called.': 0.16; 'exhibiting.': 0.16; 'inclined': 0.16; 'roy': 0.16; 'do,': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'stick': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'leave': 0.29; 'on,': 0.29; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'easier': 0.31; 'becoming': 0.31; 'piece': 0.31; 'received:192.168.1.3': 0.31; 'bugs': 0.33; 'not.': 0.33; "can't": 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'in.': 0.36; 'next': 0.36; "i'll": 0.36; 'should': 0.36; 'so,': 0.37; 'being': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'track': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'remove': 0.60; 'more': 0.64; 'situation': 0.65; 'smith': 0.68; 'behavior': 0.77; 'case?': 0.84; 'one).': 0.84; 'exhibiting': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=VT/PZT0cZDVZ8MgdNLNFXludXnVt1WAIyLa1ofI9zE0=; b=sAilR/EeQtNKQIRGS/c6RTC6C4UuLuQ0Mz8vUb8rutqcK0ouoA1/CA1MvT8phDQO/F mG6Ps6mF17njgS/hbnLjAqEohvepS+bkTO/e85XiHMWRFMtgpTfXZfLq3eXIESDRJ44X gVcTKKd99/M7fyBXAO6UIfCqEA6FwQbxg5imAeJNmbaDe69hfwwcNMidxy+ULwmBJwg+ UnWmrczrZIwH6ImDH+3QSBz57DaMicT/u5Hm5c7vCWnjEYNHeBDg8wqTODbAyoofn7dD 3VII45YiM62Enonz1v13nK2ou2OVgwRVsgIJk2UmBk4Ll++5fZNNCQl0ZPWOxgYb+zRV 3PmA== |
| X-Received | by 10.194.110.138 with SMTP id ia10mr16072781wjb.3.1384762834857; Mon, 18 Nov 2013 00:20:34 -0800 (PST) |
| Date | Mon, 18 Nov 2013 08:20:33 +0000 |
| From | Robert Day <robertkday@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: When to use assert |
| References | <528871d5$0$29975$c3e8da3$5496439d@news.astraweb.com> <roy-8BDD06.08334817112013@news.panix.com> |
| In-Reply-To | <roy-8BDD06.08334817112013@news.panix.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| 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.2824.1384763164.18130.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1384763164 news.xs4all.nl 15897 [2001:888:2000:d::a6]:37088 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:59838 |
Show key headers only | View raw
On 17/11/13 13:33, Roy Smith wrote: > Every once in a while, I'll get into a situation where something is > happening that I just can't understand. If a given pice of code is > being called, there's NO WAY the program should be exhibiting the > behavior it's exhibiting. But, there's also NO WAY that piece of code > can't be getting called. So, I stick "assert 0" in the code an re-run > the program to see if I get an AssertionError. If I do, then I know > the code is being run. If I don't then I know it's not. Either way, I > know more about what's going on than I did before. Once I know what's > going on, I remove the assert. Are assertions the right thing in that case? I'm becoming more and more inclined to the idea that if you want to know whether code is getting run, you should put a debug log in, and leave it in. That way it's easier to track down the next bug (I don't know about others, but when I write buggy code I go all-out and put lots of bugs in rather than just one). Rob
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
When to use assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-17 07:35 +0000
Re: When to use assert Tim Chase <python.list@tim.thechases.com> - 2013-11-17 06:50 -0600
Re: When to use assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-18 00:52 +0000
Re: When to use assert Roy Smith <roy@panix.com> - 2013-11-17 08:33 -0500
Re: When to use assert Robert Day <robertkday@gmail.com> - 2013-11-18 08:20 +0000
Re: When to use assert Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-11-18 09:50 +0000
Re: When to use assert Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-18 10:02 +0000
Re: When to use assert Tim Chase <python.list@tim.thechases.com> - 2013-11-18 05:44 -0600
csiph-web