Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68009

Re: Assertions are bad, m'kay?

References <mailman.7890.1394176617.18130.python-list@python.org> <5319a975$0$29985$c3e8da3$5496439d@news.astraweb.com>
Date 2014-03-07 16:15 -0800
Subject Re: Assertions are bad, m'kay?
From Dan Stromberg <drsalists@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.7909.1394237738.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Mar 7, 2014 at 3:11 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:

>
> Assertions are not bad! They're just misunderstood and abused.

> You should read this guy's blog post on when to use assert:
>
> http://import-that.dreamwidth.org/676.html

Nice article.

BTW, what about:

if value >= 3:
   raise AssertionError('value must be >= 3')

?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Assertions are bad, m'kay? Chris Angelico <rosuav@gmail.com> - 2014-03-07 18:16 +1100
  Re: Assertions are bad, m'kay? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-07 11:11 +0000
    Re: Assertions are bad, m'kay? Chris Angelico <rosuav@gmail.com> - 2014-03-07 22:24 +1100
    Re: Assertions are bad, m'kay? Dan Stromberg <drsalists@gmail.com> - 2014-03-07 16:15 -0800
      Re: Assertions are bad, m'kay? Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2014-03-08 01:26 +0100
      Re: Assertions are bad, m'kay? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-08 14:44 +0000
    Re: Assertions are bad, m'kay? Ben Finney <ben+python@benfinney.id.au> - 2014-03-08 11:22 +1100

csiph-web