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.Decim al(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.Decim al(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.deve l (the mail to
news gateway). 0 863 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 of escaping the
\n's.
A repr function that output triple-quoted strings with explicit
(non-escaped) linebreaks would be perfect.
|
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
|
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 last):
|
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 phrasebook:
http://wiki.python.org/moin/PerlPhrasebook
but saw nothing along those lines.
Thx,
|
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 doesn't work for instances of the object class:
In : eval(repr(object()))
------------------------------------------------------------
File "<string>", line 1
<object object at 0xf233e8>
| |
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
Product: Python
Versions: 2.2, 2.3, 2.4 prior to 2.4.4, wide unicode (UCS-4) builds only
CVE Names: CAN-2006-4980
|
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 community wants
it kept around or whether it is considered clutter.
The PEP is going to be finalized soon, so if you have issues with it,
they should be sent to the PEP author or brought up on the list,...
|
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 that repr() and eval() should
do. Hence the question: If s is a string, is repr(s)
guaranteed not to contain line breaks?
--
David C. Ullrich
|
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 (r25:51908, Sep 19 2006, 09:52:17) on win
32
Type "help", "copyright", "credits" or "license" for more information.
u'\u5000'
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |