bpo-45708: Support underscore separators when formatting Decimal objects by mdickinson · Pull Request #29438 · python/cpython (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation6 Commits2 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

mdickinson

This PR extends formatting for Decimal objects to support underscores as thousands separators (as described in PEP 515). Previously, Decimal only supported commas as thousands separators, while int and float support both commas and underscores.

https://bugs.python.org/issue45708

@mdickinson

sobolevn

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

I looks almost identical to what I did 🙂

serhiy-storchaka

@tiran

@mdickinson

This will break tests [...]

Darn. Thanks, @tiran - my instincts were telling me that we shouldn't modify libmpdec directly, but I failed to figure out why it was a problem.

Closing here; let's continue discussion on the issue.

@mdickinson

@mdickinson

Re-opening as a proof-of-concept draft PR to show one possible way that we could take this forward without touching libmpdec.

@github-actions

This PR is stale because it has been open for 30 days with no activity.

@belm0 belm0 mentioned this pull request

Dec 18, 2021

@mdickinson

Closing. This has served its purpose as a POC. I'm not likely to have time to turn it into a production-quality PR any time soon.

@mdickinson mdickinson deleted the support-underscore-in-decimal-format branch

April 12, 2022 16:41