[Python-ideas] Unittest error message failure context lazy creation
francismb
francismb at email.de
Sun Aug 27 08:28:09 EDT 2017
Hi Chris, Hi Steven,
> Have you measured it, eg by replacing the message with a constant? By
> what percentage does it speed up a successful test run?
How far is significant for `one` test? Please exchange the zip method
against `itertools.product` and some message creation with concatenation
(using ''.join() over some levels of testing statements (contexts). It
just adds up. But I understand you question/claim.
>> The Rules of Optimization are simple. Rule 1: Don’t do it.
>> Rule 2 (for experts only): Don’t do it yet.
>> -- Michael A. Jackson, "Principles of Program Design"
I already follow that rules and measure first ;-) and yes may be I have
had to formulate the question in a more general way:
What is the current status quo for lazy evaluation in the language or
the current ideas to avoid this type of cases?
Why should one calculate something that is in not going to be needed?
Is there a possibility to "mark somehow" a calculation + context to tell
the interpreter: "not now" ? the only thing that comes in mind to me is
to create some class that captures it and later on the `__str__` method
does the calculation for that case, but of course it makes the situation
just more complex.
Thanks for your feedback!
--francis
More information about the Python-ideas
mailing list