12.09.21 21:36, Chris Angelico пише: > I wonder, could this be simplified a bit, on the assumption that a > well-written assertion shouldn't have a problem with being executed > twice? Instead of keeping all the subexpressions around (a run-time > cost), keep the AST of the expression itself (a compile-time cost). > Then, when the exception is about to be printed to the console, > re-evaluate it and do the display.
Yes, it would simplify, but we cannot guarantee this (especially in tests). If we could, we would not need an assert. _______________________________________________ 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/R65D3VPFF5354ENFUWSXL2GQWUKZFVSH/ Code of Conduct: http://python.org/psf/codeofconduct/