[Python-ideas] Exception for developer errors?

Stefano Borini stefano.borini at gmail.com
Wed Apr 10 18:50:11 EDT 2019


That's quite a good idea, but then I think it should be more explicit
in the documentation that the purpose goes beyond the assert statement
failure. I've never seen AssertionError raised manually.

On Wed, 10 Apr 2019 at 23:15, Jeroen Demeyer <J.Demeyer at ugent.be> wrote:
>
> On 2019-04-11 00:09, Stefano Borini wrote:
> > I occasionally found situations where I want to raise an exception for
> > errors that can only arise because the developer made a mistake, for
> > example:
>
> I use AssertionError for this. An assertion failure means "this is a
> bug", so that seems the right choice to me. You don't need to use an
> actual assert statement, you can manually raise AssertionError too.
>
>
> Jeroen.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Kind regards,

Stefano Borini


More information about the Python-ideas mailing list