Skip to content

automatic integer to floating point conversion in format strings #1613

@lovasoa

Description

@lovasoa

Feature

Format codes such as 'e', 'f', and 'g' are supported in format strings for integers in CPython, but not in RustPython

in cpython

>>> f'{5:f}'
'5.000000'

in RustPython

>>>>> f'{5:f}'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Unknown format code 'f' for object of type 'int'

Python Documentation

https://docs.python.org/3/library/string.html#formatspec

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions