Eric V. Smith <[email protected]> added the comment:
The documentation doesn't say that assert statements are the only place
AssertionError is raised, so I don't think it's incorrect.
> From this, one can infer the guarantee "the -O flag will suppress
> AssertionError exceptions from being raised".
I don't think that follows from what the documentation says. It's only talking
about assert statements.
This is equivalent to StopIteration: it is commonly raised by exhausting
iterators, but it can be raised elsewhere. Or KeyError: the docs say "Raised
when a mapping (dictionary) key is not found in the set of existing keys", but
I've raised them in my own code.
> An assert[{add reference to `assert` definition}] statement fails, or a unit
> testing related assert{...}() callable detects an assertion violation.
I think that's also misleading, and not an improvement. Why focus just on
testing? It can certainly be raised elsewhere.
If anything, I think maybe add a note at the top of the list of Concrete
Exceptions saying these are common ways these exceptions are raised, but they
can be raised elsewhere. But I'm -0 on such a change.
----------
nosy: +eric.smith
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46972>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com