Thanks for the report - I think I have a fix for this, we're simply not 
recognizing \A as meaning match at the start of input (which both Python and 
.NET recognize so it's just a matter of letting us pass it through).

From: [email protected] 
[mailto:[email protected]] On Behalf Of Lukas Cenovsky
Sent: Friday, May 07, 2010 9:47 AM
To: [email protected]
Subject: [IronPython] Formating Decimal numbers / re.match bug

Hi all,
formating Decimals does not work in IronPython:

IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> '{0:3.6f}'.format(Decimal('3.5'))
Traceback (most recent call last):
 File "<stdin>", line unknown, in <module>
 File "C:\src\python\decimal.py", line 3486, in __format__
 File "C:\src\python\decimal.py", line 5416, in _parse_format_specifier
ValueError: Invalid format specifier: 3.6f


It works in CPython:

Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> '{0:3.6f}'.format(Decimal('3.5'))
'3.500000'

It looks more like re bug because 
_parse_format_specifier_regex.match(format_spec) returns None in IronPython.

--
-- Lukáš


_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to