473,504 Members | 13,621 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Change in Decimal repr in Python 2.6



Karen Tracey wrote:
I noticed when trying out Python's 2.6b2 release that the repr of
Decimal has changed since 2.5. On 2.5:

Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import decimal
>>decimal.Decimal(7)
Decimal("7")
>>>

double quotes were used whereas on 2.6b2:

Python 2.6b2 (r26b2:65082, Jul 18 2008, 13:36:54)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import decimal
>>decimal.Decimal(7)
Decimal('7')
>>>

single quotes are used. Searching around I see this was done in r60773
with the log message:

Fix decimal repr which should have used single quotes like other reprs.

but I can't find any discussion other than that.

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.

So my question:

Is this backwards-incompatible change really necessary and could it be
reconsidered?
If it's here to stay, is there some straightforward why that I am
unaware of to construct tests that use Decimal repr but will work
correctly on Python 2.3-2.6?

Also, if this is not the right list for this question please let me know
where would be more appropriate and I will go there.
If answers here do not satisfy, the pydev list would be the place to
request that this change be put off until 3.0, when changes that break
are more permissible. I do not remember any discussion of this issue.
You can also post there via news.gmane.org/g.c.python.devel (the mail to
news gateway).

Jul 19 '08 #1
0 853

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1939
by: Rasmus Fogh | last post by:
Dear All, I need a way of writing strings or arbitrary Python code that will a) allow the strings to be read again unchanged (like repr) b) write multiline strings as multiline strings instead...
21
4493
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
15
12800
by: Kay Schluehr | last post by:
I wonder why this expression works: >>> decimal.Decimal("5.5")**1024 Decimal("1.353299876254915295189966576E+758") but this one causes an error 5.5**1024 Traceback (most recent call...
2
2687
by: skip | last post by:
Sorry to ask a Perl question here, but... Does Perl have something like Python's repr() function? I want to print out a string and have CR print as \r, LF as \n, etc. I looked in the Perl/Python...
9
3979
by: Matthew Wilson | last post by:
I understand that idea of an object's __repr__ method is to return a string representation that can then be eval()'d back to life, but it seems to me that it doesn't always work. For example it...
0
1635
by: Anthony Baxter | last post by:
SECURITY ADVISORY Buffer overrun in repr() for UCS-4 encoded unicode strings http://www.python.org/news/security/PSF-2006-001/ Advisory ID: PSF-2006-001 Issue Date: October 12, 2006...
1
1106
by: Raymond Hettinger | last post by:
Was looking at PEP 3108, http://www.python.org/dev/peps/pep-3108/ , and saw that the repr module was slated for vaporization. I've only used the module a few times ever. I'm curious if the...
10
1546
by: David C. Ullrich | last post by:
I've been saving data in a file with one line per field. Now some of the fields may become multi-line strings... I was about to start escaping and unescaping linefeeds by hand, when I realized...
2
2704
by: Mark Tolonen | last post by:
I don't understand the behavior of the interpreter in Python 3.0. I am working at a command prompt in Windows (US English), which has a terminal encoding of cp437. In Python 2.5: Python 2.5...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.