[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2021-02-18 Thread Mark Dickinson
Mark Dickinson added the comment: The documentation did get updates: see #39096 for details. Closing here. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2020-11-23 Thread Mark Dickinson
Mark Dickinson added the comment: Here's a first draft of proposed re-wording for the 'e', 'f' and 'g' sections of the table in the general format-specification mini-language docs. (I started making a PR, but got too annoyed with the mechanics of editing reStructuredText tables.) 'e':

[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2020-11-23 Thread Mark Dickinson
Mark Dickinson added the comment: There's also #39096. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2020-11-23 Thread Mark Dickinson
Mark Dickinson added the comment: Some references after a bit of tracker digging: - #7098 is the original issue where the behaviour was considered. - #23460 is related, and _did_ result in a documentation change, but that documentation change didn't say anything about preserving trailing

[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2020-11-23 Thread Mark Dickinson
Mark Dickinson added the comment: Hmm. I'm not sure that it ever got documented properly. There may still be an open documentation issue somewhere. There's not really much wiggle-room for changing the implementation: the behaviour of the "g" formatting for Decimal objects is following the

[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2020-11-21 Thread Eric V. Smith
Eric V. Smith added the comment: A few things: - There is no %-formatting for Decimal types. They're being converted to float first. That's why it appears that %-formatting with 'g' works the same for decimal and float: you're really just calling the float version. - The difference in 'g'

[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2020-11-21 Thread Chris Warrick
New submission from Chris Warrick : When formatting decimal.Decimal using old-style formatting (%g), the output is as short as possible, as expected. When using new-style formatting (str.format or f-strings), the output uses the input precision. Floats behave correctly with new-style