[Python-Dev] Fwd: Change in repr of Decimal in 2.6 (original) (raw)

Karen Tracey kmtracey at gmail.com
Sun Jul 20 06:55:25 CEST 2008


On Sat, Jul 19, 2008 at 10:52 PM, Terry Reedy <tjreedy at udel.edu> wrote:

>>> f.clean('1') == Decimal('1') True

Ah, yes, why didn't I think of that?

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 >>> type(a) <type 'int'> you test will fail in 3.0 which instead prints '<class 'int'>. But >>>type(a) is int True will continue working. 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. 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. 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.

Karen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20080720/0853ceb9/attachment.htm>



More information about the Python-Dev mailing list