[IronPython] Bug when formating decimal type
Lukas Cenovsky
cenovsky at bakalari.cz
Thu Apr 22 18:28:26 CEST 2010
I haven ecountered a difference in IronPython and Python behaviors which
looks like IronPython bug:
IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal
>>> d = decimal.Decimal('3.5')
>>> d
Decimal('3.5')
>>> '{0}'.format(d)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Dos\IronPython-2.6.1\Lib\decimal.py", line 3486, in __format__
File "C:\Dos\IronPython-2.6.1\Lib\decimal.py", line 5416, in
_parse_format_spe
cifier
ValueError: Invalid format specifier:
>>> '{0!s}'.format(d)
'3.5'
Python 2.6.4 (r264:75708, Oct 26 2009, 07:36:50) [MSC v.1500 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal
>>> d = decimal.Decimal('3.5')
>>> d
Decimal('3.5')
>>> '{0}'.format(d)
'3.5'
>>> '{0!s}'.format(d)
'3.5'
>>>
--
-- Lukáš
More information about the Ironpython-users
mailing list