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 — Undocumented handling of thousands separator for floats and differences wrt Decimal · Issue #130664 · python/cpython Open Labels docsDocumentation in the Doc dirDocumentation in the Doc dirextension-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:In docs we have:
But this doesn't specify how separators are inserted for customized alignment, consider: >>> format(0.0, '>020_f') '0000000000000.000000' >>> format(0.0, '<020_f') '0.000000000000000000' >>> format(0.0, '=020_f') '0_000_000_000.000000' >>> format(0.0, '^020_f') '0000000.000000000000' Probably it's obvious, that separators might be inserted only in case of 0-padding and Note also that neither from above supported by Decimal/Fraction, e.g.: >>> format(Decimal(0.0), '=020_f') Traceback (most recent call last): File "<python-input-13>", line 1, in <module> format(Decimal(0.0), '=020_f') ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid format string >>> format(Fraction(0.0), '=020_f') ' 0.000000' >>> format(float(Fraction(0.0)), '=020_f') '0_000_000_000.000000' BTW, the rationale for Fraction's behavior (see #100161) is "no special-casing of the particular '0=' fill-character/alignment combination", which is rather weak, IMO. Either this should be fixed (preferred) or documented. CPython versions tested on:CPython main branch Operating systems tested on:No response Linked PRs
Activity
MetadataMetadataAssigneesLabelsdocsDocumentation in the Doc dirDocumentation in the Doc dirextension-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 Projects
MilestoneRelationshipsDevelopmentIssue 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. |