Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59844
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <oscar.j.benjamin@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.055 |
| X-Spam-Evidence | '*H*': 0.89; '*S*': 0.00; 'cc:addr:python-list': 0.11; 'before.': 0.16; 'cc:name:python list': 0.16; 'executed.': 0.16; 'pdb;': 0.16; 'roy': 0.16; 'do,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'stick': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'on,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'probably': 0.32; 'not.': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'so,': 0.37; 'being': 0.38; 'rather': 0.38; 'either': 0.39; 'remove': 0.60; 'more': 0.64; 'smith': 0.68; 'oscar': 0.84; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=2GDTvPsynsAMO5A3Tm9liu0zYveiu1WdIQxzGrggrhU=; b=td0VoBFPxF9nPmIwbUAwS7ilUpcEWTks2MeZaUszIUBjkRNJ9bcyr8aHqtXtatYx/l hrBWhPnV8f8fWGdnFZLnzonaQL51MnTEgfluQpjBDhg/W/QTNJRdXjvSFb9+N6nQfFJG lvqqLzI9YPONF/uomkEEjFTySOYsS1UBy+oP58ub/c5C7rZsPYUCG3MIYGnN3UpatvQ4 uLucA4ymoPDkI8OO+MyRqbH7IJoq8NsHL/WJpEHL2Tvp8pwah8E+MJ9J5vQJWuf7qK3z 7Oa3LuAg+/L2AsDv/SiuSihOE0mW7IDsAI2i+6ooxffFU63UqyLNo4nmccPVQKxZXXED Ndbw== |
| X-Received | by 10.220.144.18 with SMTP id x18mr14704263vcu.15.1384768232106; Mon, 18 Nov 2013 01:50:32 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <roy-8BDD06.08334817112013@news.panix.com> |
| References | <528871d5$0$29975$c3e8da3$5496439d@news.astraweb.com> <roy-8BDD06.08334817112013@news.panix.com> |
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
| Date | Mon, 18 Nov 2013 09:50:11 +0000 |
| Subject | Re: When to use assert |
| To | Roy Smith <roy@panix.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | Python List <python-list@python.org> |
| 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.2828.1384768239.18130.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1384768239 news.xs4all.nl 15937 [2001:888:2000:d::a6]:55384 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:59844 |
Show key headers only | View raw
On 17 November 2013 13:33, Roy Smith <roy@panix.com> wrote: > > 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. If the program is invoked from a terminal I would probably go with 'import pdb; pdb.set_trace()' rather than 'assert 0'. Then you can check much more than whether or not the code is being executed. It's a bit more to type but I type it so often that I can now type it *really fast*. Oscar
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