-
-
Notifications
You must be signed in to change notification settings - Fork 109
Description
TOML allows an underscore anywhere in an integer, as long as there is a digit each side of it:
For large numbers, you may use underscores between digits to enhance readability. Each underscore must be surrounded by at least one digit on each side.
int5 = 1_000 int6 = 5_349_221 int7 = 53_49_221 # Indian number system grouping int8 = 1_2_3_4_5 # VALID but discouraged
I'd like to be able to emit an underscore-formatted integer when dump/sing a TOML file.
This is probably quite hard to implement with full flexibility, but it would be good to either be able to indicate some level of customisation, e.g. "use an underscore to indicate 100s" or "use an underscore to indicate 1000s", or alternatively to be able to supply a _-formatted integer as a string, and have tomlkit render it as a number, without quotation marks.
Happy to discuss if there's interest. Otherwise I can try a PR, but I'd rather get some consensus first.