[Python-ideas] Specify an alternative exception for "assert"

Guido van Rossum guido at python.org
Mon May 2 12:37:40 EDT 2016

On Mon, May 2, 2016 at 9:32 AM, Ryan Gonzalez <rymg19 at gmail.com> wrote:

> I would still prefer the proposal that requires the errors to derive from
> AssertionError, since there *are* people that will use this for some sort
> of data validation. It's more likely because of Python's "easier to ask
> forgiveness than permission" idea; imagine someone "asserts" with a custom
> exception that some sort of input data is correct/safe. Then someone else
> uses the library in their website. With -O. If it's restricted to
> subclasses of AssertionError, then people will be less likely to use it for
> random error checking that *should* run in release mode.

I don't believe your logic is correct. And the OP most assuredly does *not*
want to raise a subclass of AssertionError. He's written enough Python code
to know what he's talking about, so I take him serious -- whereas your
argument so far is mere FUD.

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160502/5eb14927/attachment.html>

More information about the Python-ideas mailing list