A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-April/044269.html below:

[Python-Dev] Decimal conversion to string

[Python-Dev] Decimal conversion to stringBatista, Facundo FBatista at uniFON.com.ar
Wed Apr 14 17:58:11 EDT 2004
[Ka-Ping Yee]

#- Could we please have repr(d) use the string in the constructor
#- rather than the tuple form?  That would be much easier to read.
#- 
#- So, for example:
#- 
#-     >>> Decimal('12345')
#-     Decimal('12345')     # instead of Decimal((0, (1, 2, 3, 4, 5, 0))
#-     >>> _ * 10
#-     Decimal('1.2345e1')
#-     >>> Decimal('12345', 2)
#-     Decimal('1.2e3')
#-     >>> Decimal(1.1)
#-     Decimal('1.100000000000000088817841970012523233890533447265625')
#-     >>> Decimal(1.1, default_context=1)
#-     Decimal('1.10000000')

To *me* is more natural the tuples. But that's only because that's what the
internal objects are.

An intermediate solution can be something like: 

>>> Decimal('12345')
Decimal(0, 12345, 0)

a tuple of three values: sign, coefficient, and exponent. The three of them
as integers.}

Anyway, if you want to change the repr() behaviour, you should push it hard
to the list. I'm -0 on it.

.	Facundo

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4