On Thu, Sep 1, 2022 at 2:57 PM Jean Abou Samra <j...@abou-samra.fr> wrote:

>
> How would
> a "state error" differ from this more precisely? What value would this new
> exception type add? Both ValueError and this proposed StateError are very
> generic.
>

 Some examples:

* a stream-like object that has been closed and you attempt to read from or
write data to it.

* a random number generator that has not been initialized with a seed (in
the case where you have a constructor which doesn't also initialize it).

* a hash function which you try to compute the digest without having added
any data to it.

In all these cases, the current call fails because a *previous* call was
not done. The parameters to this invocation are not by themselves incorrect.

--- Bruce
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XREF2WPN7HW5TBTORERQJFUEJXKOUPJB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to