Assertions are bad, m'kay?

Chris Angelico rosuav at
Fri Mar 7 12:24:29 CET 2014

On Fri, Mar 7, 2014 at 10:11 PM, Steven D'Aprano
<steve+comp.lang.python at> wrote:
>> 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 :)


More information about the Python-list mailing list