-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
It's possible to "change" the repr style for floats:
Python 3.14.0a2+ (heads/long_export-decimal:4bb9ad04f5, Dec 17 2024, 05:39:57) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.float_repr_style
'short'
>>> sys.float_repr_style = 'legacy'
>>> sys.float_repr_style
'legacy'
Of course, this has no effect, as this variable just shows build-time settings. That certainly can misguide people, e.g. see this: #128005 (comment)
It could be nice to make this variable read-only (unfortunately, PEP 726 was rejected and it's might be not so easy). Or, at least, improve docs to mention that it's intended to be read-only (we emphasize this e.g. for int_info fields).
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Todo