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 sndrtj
Recipients sndrtj
Date 2021-11-04.09:01:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636016474.79.0.0748645326286.issue45708@roundup.psfhosted.org>
In-reply-to
Content
Hello,

It appears that Decimal does not support PEP-515 style formatting with underscores as thousands separators. 

```
>>> from decimal import Decimal
>>> f"{Decimal('5000'):,}"
'5,000'
>>> f"{Decimal('5000'):_}"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid format string

```

This does work for all the other types mentioned in PEP515

```
>>> f"{5000:_}"
'5_000'
>>> f"{5000.0:_}"
'5_000.0'
>>> f"{complex(5000, 1):_}"
'(5_000+1j)'
```

I have tried this on python 3.8, 3.9 and 3.10 on a Mac.
History
Date User Action Args
2021-11-04 09:01:14sndrtjsetrecipients: + sndrtj
2021-11-04 09:01:14sndrtjsetmessageid: <1636016474.79.0.0748645326286.issue45708@roundup.psfhosted.org>
2021-11-04 09:01:14sndrtjlinkissue45708 messages
2021-11-04 09:01:14sndrtjcreate