[docs] [issue32720] Format mini-language integer definition is incorrect

Nick Coghlan report at bugs.python.org
Mon Jan 29 23:45:29 EST 2018


New submission from Nick Coghlan <ncoghlan at gmail.com>:

I just noticed that https://docs.python.org/3/library/string.html#formatspec links to the "integer" definition in the main Python grammar for the permitted format of numeric fields.

This isn't accurate:

```
>>> format(10e4, ",.2f")
'100,000.00'
>>> format(10e4, ",.0x2f")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid format specifier
>>> format(10e4, ",.2_2f")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid format specifier
```

Instead, the `width` and `precision` subfields should be defined as "digit+"

----------
assignee: docs at python
components: Documentation
messages: 311229
nosy: docs at python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Format mini-language integer definition is incorrect
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32720>
_______________________________________


More information about the docs mailing list