GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `,` works with `Decimal()` against the doc of **Format Specification Mini-Language** · Issue #136636 · python/cpython Closed as duplicate Closed as duplicate Copy link Labels 3.13only security fixesonly security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:The doc of Format Specification Mini-Language doesn't say that
But from decimal import Decimal v = Decimal(value='1234.5555555555') print('"{:,.20f}"'.format(v)) print('"{:,.20F}"'.format(v)) # "1,234.55555555550000000000" # | 20 | print('"{:,f}"'.format(v)) print('"{:,F}"'.format(v)) # "1,234.5555555555" # | 10 | from decimal import Decimal v = Decimal('123456.78912') print('"{:,.20g}"'.format(v)) print('"{:,.20G}"'.format(v)) print('"{:,.20}"'.format(v)) print('"{:,g}"'.format(v)) print('"{:,G}"'.format(v)) print('"{:,}"'.format(v)) # "123,456.78912" # | 11 | In addition, the doc doesn't say that
So, from decimal import Decimal v = Decimal(value='1234.5555555555') print('"{:_.20f}"'.format(v)) print('"{:_.20F}"'.format(v)) print('"{:_f}"'.format(v)) print('"{:_F}"'.format(v)) # ValueError: invalid format string from decimal import Decimal v = Decimal('123456.78912') print('"{:_.20g}"'.format(v)) print('"{:_.20G}"'.format(v)) print('"{:_.20}"'.format(v)) print('"{:_g}"'.format(v)) print('"{:_G}"'.format(v)) print('"{:_}"'.format(v)) # ValueError: invalid format string CPython versions tested on:3.12 Operating systems tested on:Windows Activity
MetadataMetadataAssigneesLabels3.13only security fixesonly security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |