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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement __format__ for Decimal #46364
Comments
A remainder. |
I can take a look at this if you like. But I don't want to spoil your fun |
Please, be my guest! Thanks! |
Here's a first attempt at Decimal.__format__; the patch is against the I'm adding Raymond Hettinger and Eric Smith to the nosy list in case Some points of interest:
There are other possible options here (have a default precision; use
|
I've committed a reworked version of the patch in r61123. |
Reopening this; I'd like to have a second go at implementing the 'n' See bpo-2802 for hints about how to go about this. |
Adding support for the 'n' format specifier should be done before 3.1 goes |
Here's a patch to implement the 'n' format specifier for Decimals Raymond, could you give this a sanity check? |
Sure, I will take a look. |
Mark, this looks fine. Can you add support for PEP-378? |
New version of decimal_n_format.patch, with support for the thousands >>> format(Decimal('123456'), '08,')
'0,123,456' The Decimal.__format__ method (and support code) had to be fairly |
The tests you submitted are reassuring. I think you should go ahead and |
Committed, r70439 and r70440. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: