Skip to content

Move description of grouping options in format specification docs #131912

Closed
@Prometheus3375

Description

@Prometheus3375

The form of format specifier is the following

[[fill]align][sign]["z"]["#"]["0"][width][grouping_option]["." precision][type]

Docs describe each option in the following order:

  1. align and fill.
  2. sign.
  3. Option z.
  4. Option #.
  5. Option ,.
  6. Option _.
  7. width, then option 0.
  8. precision.
  9. type.

As you can notice, options , and _ are not present in format spec, because they are actually part of grouping_option. For whatever reason they are described before width, but most importantly, their descriptions never mention they are part of grouping_option.

It can be super confusing for the first readthrough, as descriptions are out of order and written similar to standalone options z and #. I suggest the following changes:

  1. Place descriptions of options , and _ after the description of width.
  2. Mention that they are part of grouping_option.
  3. Maybe change BNF specification of grouping_option to "," | "_" to match their description order and order of addition to Python.

Example change:

The grouping_option determines how digits in numbers are grouped. Its first option, ',', signals...

The other grouping_option, '_', signals...

Alternatively, these description can be placed in a table, similar for the list of string presentation types.

The grouping_option determines how digits in numbers are grouped. It can be one of the following:

==here goes the table==

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions