[issue19562] Added description for assert statement

Terry J. Reedy report at bugs.python.org
Sat Nov 16 01:57:30 CET 2013


Terry J. Reedy added the comment:

Since failed asserts print the failed assert, repeating the assertion in a message is useless.
>>> assert 1 <= i
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    assert 1 <= i
AssertionError

It is already obvious that i must be >= 1. So I would reject the patch.

> And isn't this too much defensive programming?

Whether stdlib python code should have asserts is a more interesting question. I will ask on pydev.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19562>
_______________________________________


More information about the Python-bugs-list mailing list