<div dir="ltr">On Sat, Jul 19, 2008 at 10:52 PM, Terry Reedy <<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>>> f.clean('1') == Decimal('1')<br>
True<br>
</blockquote><div><br>Ah, yes, why didn't I think of that?<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Since 'True' is a keyword, and Guido is *very* reluctant to even add keywords, let alone change their spelling, I think you can depend on that working indefinitely. Similarly, if you now have<br>
<br>
>>> type(a)<br>
<type 'int'><br>
<br>
you test will fail in 3.0 which instead prints '<class 'int'>. But<br>
<br>
>>>type(a) is int<br>
True<br>
<br>
will continue working.<br>
<br>
Doctest has two quite different uses. One is to check text with interactive examples to make sure there are no mistakes in the examples. For that, printing representations is usually the natural style. Then one must accept that representations change faster that object behavior.<br>
<br>
The other use is to check code. For that, the more stilted style is more future-proof. For text doing double duty as a formal reference and code test, I would go for cross-version dependability.<br>
<br>
</blockquote><div><br>Thanks, I see your point about the different styles. I think we have a fair number of tests that use the print-style (probably because that's easiest, and then people see that style everywhere and do the same when adding new tests) when to be future proof they really should be using the alternative. <br>
<br>Karen<br></div></div><br></div>