This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients ezio.melotti, mark.dickinson
Date 2009-07-29.08:39:51
SpamBayes Score 8.148482e-13
Marked as misclassified No
Message-id <>
Ezio Melotti asked (on #python-dev) why the Decimal constructor doesn't 
accept decimal digits other than 0-9.  As far as I can tell there's no 
good reason for it not to.  Moreover, the standard on which the decimal 
module is based says[1]:

"""It is recommended that implementations also provide additional number 
formatting routines (including some which are locale-dependent), and if 
available should accept non-European decimal digits in strings."""

All other builtin or standard library numeric types already accept such 

Python 3.2a0 (py3k:74247, Jul 29 2009, 09:28:12) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from fractions import Fraction
>>> from decimal import Decimal
>>> x = '\uff11\uff10\uff15\uff18\uff15'
>>> x
>>> int(x)
>>> float(x)
>>> complex(x)
>>> Fraction(x)
Fraction(10585, 1)
>>> Decimal(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dickinsm/python/svn/py3k/Lib/", line 548, in 
    "Invalid literal for Decimal: %r" % value)
  File "/Users/dickinsm/python/svn/py3k/Lib/", line 3816, in 
    raise error(explanation)
decimal.InvalidOperation: Invalid literal for Decimal: '10585'

I propose adding support for this in Python 3.2 and (possibly) 2.7.  The 
change would be for input only:  no record of the original form of the 
digits would be kept by the Decimal object itself, so that e.g.,
str(Decimal('10585')) would still be '10585'.

[1] See
Date User Action Args
2009-07-29 08:39:55mark.dickinsonsetrecipients: + mark.dickinson, ezio.melotti
2009-07-29 08:39:55mark.dickinsonsetmessageid: <>
2009-07-29 08:39:53mark.dickinsonlinkissue6595 messages
2009-07-29 08:39:51mark.dickinsoncreate