Issue32720
Created on 2018-01-30 04:45 by ncoghlan, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 5482 | merged | nkerr, 2018-02-02 01:12 | |
| PR 5524 | merged | miss-islington, 2018-02-04 05:43 | |
| PR 5525 | merged | miss-islington, 2018-02-04 05:44 | |
| PR 5544 | merged | Mariatta, 2018-02-05 03:11 | |
| PR 5546 | merged | miss-islington, 2018-02-05 09:30 | |
| PR 5547 | merged | miss-islington, 2018-02-05 09:31 | |
| Messages (11) | |||
|---|---|---|---|
| msg311229 - (view) | Author: Alyssa Coghlan (ncoghlan) * ![]() |
Date: 2018-01-30 04:45 | |
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+" |
|||
| msg311471 - (view) | Author: Nathan Kerr (nkerr) * | Date: 2018-02-02 01:18 | |
Just submitted a PR for this issue, however I only signed the CLA an hour ago so it hasn't gone through yet. This is my first contribution, I followed the guide but please let me know if I missed anything. Thanks! |
|||
| msg311586 - (view) | Author: Mariatta (Mariatta) * ![]() |
Date: 2018-02-04 05:42 | |
New changeset 8b5fa289fdb04b6b919cf95fa99246aa872e47a8 by Mariatta (nathankerr96) in branch 'master': bpo-32720: Fixed the definition for width and precision in format mini-language doc (GH-5482) https://github.com/python/cpython/commit/8b5fa289fdb04b6b919cf95fa99246aa872e47a8 |
|||
| msg311587 - (view) | Author: Mariatta (Mariatta) * ![]() |
Date: 2018-02-04 06:03 | |
New changeset 133514e9dcea9c8cc9d9dd459b1a7fb502747d7e by Mariatta (Miss Islington (bot)) in branch '3.7': bpo-32720: Fixed the definition for width and precision in format mini-language doc (GH-5482) (GH-5524) https://github.com/python/cpython/commit/133514e9dcea9c8cc9d9dd459b1a7fb502747d7e |
|||
| msg311588 - (view) | Author: Mariatta (Mariatta) * ![]() |
Date: 2018-02-04 06:26 | |
New changeset 3bd749b2122c17b835dc438cdaef63bfdfd61344 by Mariatta (Miss Islington (bot)) in branch '3.6': bpo-32720: Fixed the definition for width and precision in format mini-language doc (GH-5482) (GH-5525) https://github.com/python/cpython/commit/3bd749b2122c17b835dc438cdaef63bfdfd61344 |
|||
| msg311589 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-02-04 06:28 | |
What about arg_name and element_index?
>>> '{}'.format(123)
'123'
>>> '{0}'.format(123)
'123'
>>> '{0x0}'.format(123)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: '0x0'
>>> '{0_0}'.format(123)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: '0_0'
>>> '{0[0]}'.format([123])
'123'
>>> '{0[0x0]}'.format([123])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list indices must be integers or slices, not str
>>> '{0[0_0]}'.format([123])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list indices must be integers or slices, not str
|
|||
| msg311636 - (view) | Author: Alyssa Coghlan (ncoghlan) * ![]() |
Date: 2018-02-05 02:38 | |
I didn't think to check those - it looks like they have the same problem with the same fix (i.e. the actual syntax is "digit+"). |
|||
| msg311657 - (view) | Author: Mariatta (Mariatta) * ![]() |
Date: 2018-02-05 09:29 | |
New changeset 7a561afd2c79f63a6008843b83733911d07f0119 by Mariatta in branch 'master': bpo-32720: Fixed the replacement field grammar documentation. (GH-5544) https://github.com/python/cpython/commit/7a561afd2c79f63a6008843b83733911d07f0119 |
|||
| msg311758 - (view) | Author: Mariatta (Mariatta) * ![]() |
Date: 2018-02-07 01:14 | |
New changeset a747cf6d9b87ea8c7ce3a42d09e5b966c8e83fa0 by Mariatta (Miss Islington (bot)) in branch '3.7': bpo-32720: Fixed the replacement field grammar documentation. (GH-5544) (GH-5546) https://github.com/python/cpython/commit/a747cf6d9b87ea8c7ce3a42d09e5b966c8e83fa0 |
|||
| msg312032 - (view) | Author: miss-islington (miss-islington) | Date: 2018-02-12 08:07 | |
New changeset 6708be744d032aeffab3e2cf0b064a41a719d8a1 by Miss Islington (bot) in branch '3.6': bpo-32720: Fixed the replacement field grammar documentation. (GH-5544) (GH-5547) https://github.com/python/cpython/commit/6708be744d032aeffab3e2cf0b064a41a719d8a1 |
|||
| msg312033 - (view) | Author: Mariatta (Mariatta) * ![]() |
Date: 2018-02-12 08:09 | |
Thanks! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:57 | admin | set | github: 76901 |
| 2019-05-17 12:52:34 | cheryl.sabella | link | issue19175 superseder |
| 2018-02-12 08:09:29 | Mariatta | set | status: open -> closed resolution: fixed messages: + msg312033 stage: patch review -> resolved |
| 2018-02-12 08:07:57 | miss-islington | set | nosy:
+ miss-islington messages: + msg312032 |
| 2018-02-07 01:14:22 | Mariatta | set | messages: + msg311758 |
| 2018-02-05 09:31:11 | miss-islington | set | pull_requests: + pull_request5373 |
| 2018-02-05 09:30:18 | miss-islington | set | pull_requests: + pull_request5372 |
| 2018-02-05 09:29:10 | Mariatta | set | messages: + msg311657 |
| 2018-02-05 03:11:46 | Mariatta | set | pull_requests: + pull_request5370 |
| 2018-02-05 02:38:14 | ncoghlan | set | messages: + msg311636 |
| 2018-02-04 06:28:50 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg311589 |
| 2018-02-04 06:26:18 | Mariatta | set | messages: + msg311588 |
| 2018-02-04 06:03:23 | Mariatta | set | messages: + msg311587 |
| 2018-02-04 05:44:16 | miss-islington | set | pull_requests: + pull_request5354 |
| 2018-02-04 05:43:17 | miss-islington | set | pull_requests: + pull_request5353 |
| 2018-02-04 05:42:10 | Mariatta | set | nosy:
+ Mariatta messages: + msg311586 |
| 2018-02-02 01:18:48 | nkerr | set | nosy:
+ nkerr messages: + msg311471 |
| 2018-02-02 01:12:29 | nkerr | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request5313 |
| 2018-02-01 23:50:54 | cheryl.sabella | set | keywords: + easy |
| 2018-01-30 04:45:29 | ncoghlan | create | |
