On 11/28/2017 08:03 AM, Ivan Pozdeev via Python-ideas wrote:
On 28.11.2017 16:36, Nick Coghlan wrote:

   it doesn't need to be a statement any more
>
Another benefit of a statement vs function is only evaluating the error-related 
arguments when there's an error

The bulk of any processing in assert (or ensure()) should be the actual check -- if that fails, only state information should be included in the exception as anything more complicated runs the risk of also being wrong as the code is now in a failed state. In other words, the "error-related arguments" will often be extremely cheap compared to the test itself.

--
~Ethan~
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to