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


Groups > comp.lang.python > #67991

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 22:24 +1100
Subject Re: Assertions are bad, m'kay?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.7897.1394191472.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Mar 7, 2014 at 10:11 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
>> http://xkcd.com/1339/
>>
>> Abusing assert for arg checking violates XKCD 1339. Write
>> standards-compliant code!
>
> Assertions are not bad! They're just misunderstood and abused.
>
> (By the way, assertions are not the same as assumptions. Asserts can be
> used to check that assumptions are correct, or to check the internal
> logic of your reasoning. Whereas assumptions are just accepted as if they
> were correct, no questions asked.

The XKCD does draw a distinction between assuming and asserting. And I
do say "for arg checking", which is the most common *abuse* of assert.
But mainly, I just like to share laughs :)

ChrisA

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