<div dir="ltr">[Originally posted to python-list but on further reflection and some feedback I think it might be more appropriate here.]<br><br>I noticed when trying out Python's 2.6b2 release that the repr of Decimal has changed since 2.5. On 2.5:<br>
<br>Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) <br>[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2<br>
Type "help", "copyright", "credits" or "license" for more information.<br>>>> import decimal<br>>>> decimal.Decimal(7)<br>Decimal("7")<br>>>> <br>
<br>double quotes were used whereas on 2.6b2:<br><br>Python 2.6b2 (r26b2:65082, Jul 18 2008, 13:36:54) <br>[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2<br>Type "help", "copyright", "credits" or "license" for more information.<br>
>>> import decimal<br>>>> decimal.Decimal(7)<br>Decimal('7')<br>>>> <br><br>single quotes are used. Searching around I see this was done in r60773 with the log message:<br><br>Fix decimal repr which should have used single quotes like other reprs.<br>
<br>but I can't find any discussion other than that. <br><br>My
problem is this breaks a bunch of doctests that were written assuming
the prior repr. I can't just update the tests to assume the new single
quotes because they are for code that is supposed to run on everything
back to Python 2.3. <br>
<br>So my questions:<br><br>Is this backwards-incompatible change really necessary and could it be reconsidered?<br><br>If
it's here to stay, is there some straightforward way that I am unaware
of to construct tests that use Decimal repr but will work correctly on
Python 2.3-2.6?<br>
<br>Thanks for any feedback,<br>Karen<br></div>