Skip to content

f-string comma format adds leading comma for 12 digits (and 15…) #9487

Open
@mMerlin

Description

@mMerlin

CircuitPython version

Adafruit CircuitPython 9.0.5 on 2024-05-22; Adafruit-Qualia-S3-RGB666 with ESP32S3

Code/REPL

v = 1
for _n in range(30):
    l = f'{v:,}'[0:1]
    if l == ',':
        print(f'{v:,}')
    v *= 10

Behavior

,100,000,000,000
,100,000,000,000,000
,100,000,000,000,000,000
,100,000,000,000,000,000,000
,100,000,000,000,000,000,000,000
,100,000,000,000,000,000,000,000,000
,100,000,000,000,000,000,000,000,000,000

Description

When the the number of digits is a multiple of 3, and at least 12, the f-string comma formatting is adding a leading comma.
Using 9.0.5 for the qualia board, due to display glitches with 9.1

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions