summaryrefslogtreecommitdiffstats
path: root/Doc/library/string.rst
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] Docs: use boolean constants for returning boolean value (GH-133325) ↵Miss Islington (bot)2025-05-091-1/+1
| | | | | | | (GH-133761) (cherry picked from commit 076004ae5461cf3a7fe248a38e28afff33acdd14) Co-authored-by: Yongzi Li <1538321957@qq.com>
* [3.13] gh-131912: Improve description of grouping options in the format ↵Prometheus33752025-04-071-33/+55
| | | | | specification docs (GH-132030) (#132123) (cherry picked from commit 06a110f5227ba9d52f6205fde55924a14cab36ff)
* [3.13] gh-67206: Document that `string.printable` is not printable in the ↵Miss Islington (bot)2025-01-151-3/+10
| | | | | | | | POSIX sense (GH-128820) (#128868) gh-67206: Document that `string.printable` is not printable in the POSIX sense (GH-128820) (cherry picked from commit d906bde250d59c396d8dab92285b832c66cdec27) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-127852: add remark about ',' separator (GH-127854) (#127941)Miss Islington (bot)2024-12-141-1/+3
| | | | | | | | | Specify that it is valid for floats and ints with 'd' presentation and an error otherwise. --------- (cherry picked from commit e2325c9db0650fc06d909eb2b5930c0573f24f71) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* [3.13] gh-99880: document rounding mode for new-style formatting (GH-121481) ↵Miss Islington (bot)2024-12-021-0/+5
| | | | | | | | | | | | | | | | | (#126334) The CPython uses _Py_dg_dtoa(), which does rounding to nearest with half to even tie-breaking rule. If that functions is unavailable, PyOS_double_to_string() fallbacks to system snprintf(). Since CPython 3.12, build requirements include C11 compiler *and* support for IEEE 754 floating point numbers (Annex F). This means that FE_TONEAREST macro is available and, per default, printf-like functions should use same rounding mode as _Py_dg_dtoa(). (cherry picked from commit 7d7d56d8b1147a6b85e1c09d01b164df7c5c4942) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-122767: document "new style" formatting for complexes (GH-122848) ↵Miss Islington (bot)2024-11-011-5/+15
| | | | | | | | | | (#126128) gh-122767: document "new style" formatting for complexes (GH-122848) (cherry picked from commit 0bbbe15f5688552236c48f2b6e320c5312720b8e) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-123133: clarify p=0 case for "f" and "e" formatting types ↵Miss Islington (bot)2024-10-141-6/+4
| | | | | | | | | (GH-125426) (#125428) gh-123133: clarify p=0 case for "f" and "e" formatting types (GH-125426) (cherry picked from commit cfc27bc50fe165330f2295f9ac0ad56ca5b0f31c) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-123560: Correct docs for "empty" format type for floats ↵Miss Islington (bot)2024-09-261-3/+5
| | | | | | | | (GH-123561) (#124596) gh-123560: Correct docs for "empty" format type for floats (GH-123561) (cherry picked from commit 274d9ab619b8150a613275835234ea9ef935f21f) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* [3.13] gh-121905: Consistently use "floating-point" instead of "floating ↵Serhiy Storchaka2024-07-191-3/+3
| | | | | point" (GH-121907) (GH-122012) (cherry picked from commit 1a0c7b9ba48a2dffb70bb0c7327abae1d3e87356)
* [3.13] docs: module page titles should not start with a link to themselves ↵Miss Islington (bot)2024-05-081-2/+2
| | | | | | | | (GH-117099) (#118790) docs: module page titles should not start with a link to themselves (GH-117099) (cherry picked from commit bcb435ee8ff41b5ec5d879ee0b6651f146a66151) Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
* Docs: Link tokens in the format string grammars (#108184)William Andrea2024-01-091-7/+7
| | | | Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* gh-110631: Fix reST indentation in `Doc/library` (#110685)Ezio Melotti2023-10-111-50/+50
| | | Fix wrong indentation in the Doc/library dir.
* GH-95088: Clarify rules for parsing an item key for format strings (#103779)achhina2023-06-071-1/+3
| | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-101100: Fix broken reference `__format__` in `string.rst` (#103531)yuki2023-04-181-2/+2
|
* Docs: Fix broken reference `__getitem__` in `string.rst` (#103371)yuki2023-04-091-1/+1
|
* Quote literal tokens in standard format specifier grammar (GH-102902)Petr Viktorin2023-03-311-1/+1
| | | Reported by Damian Dureck: https://mail.python.org/archives/list/docs@python.org/thread/UZTWBJIXC3MBKTHXVTIBPGDPKBNWZ5LN/
* GH-95685: Fix rendering of the string documentation (#95686)Mariatta Wijaya2022-08-051-0/+1
| | | | | | There's an extra underlines that messed the rest of the documentation rendering. Closes #95685
* gh-91838: Use HTTPS links in docs for resources which redirect to HTTPS ↵Serhiy Storchaka2022-08-041-1/+1
| | | | | | | | | | (GH-95527) If an HTTP link is redirected to a same looking HTTPS link, the latter can be used directly without changes in readability and behavior. It protects from a men-in-the-middle attack. This change does not affect Python examples.
* bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)John Belmonte2022-04-111-1/+10
| | | | | | | | Add "z" format specifier to coerce negative 0 to zero. See https://github.com/python/cpython/issues/90153 (originally https://bugs.python.org/issue45995) for discussion. This covers `str.format()` and f-strings. Old-style string interpolation is not supported. Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* Corrections to format precision description. (GH-31291)John Belmonte2022-02-141-5/+6
| | | | | | | | | | | * `precision` field is a decimal integer * clarify that stated limitations are on presentation type rather than input value type. Especially misleading is "precision is not allowed for integer values", since integer value input to a format like `.1f` is fine. * regarding max field size, replace "non-number" with "string", which is the only non-numeric presentation type Automerge-Triggered-By: GH:ericvsmith
* bpo-46307: Add string.Template.get_identifiers() method (GH-30493)Ben Kehoe2022-01-111-0/+19
| | | | | Add `string.Template.get_identifiers()` method that returns the identifiers within the template. By default, raises an error if it encounters an invalid identifier (like `substitute()`). The keyword-only argument `raise_on_invalid` can be set to `False` to ignore invalid identifiers (like `safe_substitute()`). Automerge-Triggered-By: GH:warsaw
* docs: clearly document that ":#X" string formatting results in "0X..." ↵Tal Einat2021-05-061-2/+4
| | | | | | | (GH-25941) * clearly document that ":#X" string formatting results in "0X..." * put back the "serial comma"
* bpo-31907: [doc] clarify that str.format() does not support arbitrary ↵Irit Katriel2021-03-281-2/+2
| | | | expressions (#25053)
* bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)Serhiy Storchaka2021-01-251-2/+6
| | | | Previously it was an error with confusing error message.
* bpo-39096: Format specification documentation fixes for numeric types (GH-23575)Mark Dickinson2020-12-181-12/+23
|
* bpo-39096: Improve description of 'e', 'f' and 'g' presentation types (#23537)Mark Dickinson2020-11-291-12/+31
| | | | | | | | | | | * Improve description of 'e', 'f' and 'g' presentation types * Drop the 'E' from Scientific 'E' notation; remove >= 0 qualifications * Fix false statement that the alternate form is valid for Decimal * Nitpick: remove the Harvard/Oxford comma * Add note that the decimal point is also removed if no digits follow it, except in alternate form
* bpo-41762: Fix usage of productionlist markup in the doc (GH-22281)Victor Stinner2020-09-181-2/+2
| | | | | | | Use an unique identifier for the different grammars documented using the Sphinx productionlist markup. productionlist markups of the same grammar, like "expressions" or "compound statements", use the same identifier "python-grammar".
* bpo-40204: Fix duplicated productionlist names in the doc (GH-21900)Victor Stinner2020-08-171-1/+1
| | | | | | | | Sphinx 3 disallows having more than one productionlist markup with the same name. Simply remove names in this case, since names are not shown anyway. For example, fix the Sphinx 3 warning: Doc/reference/introduction.rst:96: duplicate token description of *:name, other instance in reference/expressions
* bpo-13790: Change 'string' to 'specification' in format doc (GH-18690)Terry Jan Reedy2020-02-281-2/+2
|
* bpo-38657: Clarify numeric padding behaviour in string formatting (GH-17036)Pete Wicken2020-02-211-2/+3
| | | | | | | | | | | Make the definition of the width more explicit that it includes any extra signs added by other options. https://bugs.python.org/issue38657 Automerge-Triggered-By: @Mariatta
* bpo-32790: Add info about alt format using # for 'g' in chart (GH-6624)bchhabra24902019-09-131-1/+2
|
* bpo-23460: Fix documentation for decimal string :g formatting (GH-11850)Brennan D Baraban2019-09-111-3/+4
|
* bpo-36168: Lowercase the word "subsequent" in get_value doc (GH-14485)Krishna Oza2019-07-011-1/+1
| | | | | Subsequent -> subsequent https://bugs.python.org/issue36168
* bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)Serhiy Storchaka2019-06-011-3/+3
|
* Document actual string.punctuation value. (GH-12270)Andre Delfino2019-03-141-2/+1
|
* Correct grammar mistakes in string.rst. (GH-9752)Andrés Delfino2018-11-071-2/+2
|
* bpo-35110: Fix unintentional spaces around hyphens and dashes. (GH-10231)Serhiy Storchaka2018-10-311-4/+4
|
* bpo-35054: Add yet more index entries for symbols. (GH-10121)Serhiy Storchaka2018-10-281-17/+15
|
* bpo-35054: Add more index entries for symbols. (GH-10064)Serhiy Storchaka2018-10-261-0/+28
|
* bpo-34273: Change 'Fixed point' to 'Fixed-point notation'. (#8673)Terry Jan Reedy2018-08-061-4/+4
| | | | | | | | | | | | | | | * bpo-34273: Change 'Fixed point' to 'Fixed-point notation'. The change in the mini language floating point and decimal table is consistent with 'Exponential notation' and clarifies that we are referring to the output notation, not an object type. * Update string.rst * Update string.rst * Update string.rst * Update string.rst
* bpo-33828: Add missing versionchanged note for string.Formatter. (GH-7668)Xiang Zhang2018-06-131-2/+5
| | | | | string.Formatter auto-numbering feature was added in 3.4 and there is no versionchanged note in its documentation, making the documentation ambiguous about which version the feature is available.
* bpo-32720: Fixed the replacement field grammar documentation. (GH-5544)Mariatta2018-02-051-2/+2
| | | | `arg_name` and `element_index` are defined as `digit`+ instead of `integer`.
* bpo-32720: Fixed the definition for width and precision in format ↵nathankerr962018-02-041-2/+2
| | | | | mini-language doc (GH-5482) Changed the definition of width and precision from "integer" to "digit+" in format mini-language doc.
* bpo-31672: Restore the former behavior when override flags in Template. (#5099)Serhiy Storchaka2018-01-041-7/+2
| | | | Overriding flags to 0 will make the default pattern matching only lower case letters.
* bpo-31672 - Add one last minor clarification for idpattern (#4483)Barry Warsaw2017-11-211-2/+4
| | | Add one last minor clarification for idpattern
* bpo-31672: doc: Remove one sentence from library/string.rst (GH-3990)INADA Naoki2017-10-141-1/+1
| | | | This sentence is removed while backporting to 3.6 branch. See https://github.com/python/cpython/pull/3982#discussion_r144555768
* bpo-31672: Fix string.Template accidentally matched non-ASCII identifiers ↵INADA Naoki2017-10-131-2/+11
| | | | | | | | | | | (GH-3872) Pattern `[a-z]` with `IGNORECASE` flag can match to some non-ASCII characters. Straightforward solution for this is using `IGNORECASE | ASCII` flag. But users may subclass `Template` and override only `idpattern`. So we want to avoid changing `Template.flags`. So this commit uses local flag `-i` for `idpattern` and change `[a-z]` to `[a-zA-Z]`.
* bpo-1198569: Allow string.Template braced pattern to be different (#3288)Barry Warsaw2017-09-041-3/+15
| | | | | | | | * bpo-1198569: Allow the braced pattern to be different ``string.Template`` subclasses can optionally define ``braceidpattern`` if they want to specify different placeholder patterns inside and outside the braces. If None (the default) it falls back to ``idpattern``.
* Improve the documentation for template strings (#856)Barry Warsaw2017-03-281-11/+19
| | | | | bpo-19824 bpo-20314 bpo-12518
* Issue #29193: A format string argument for string.Formatter.format()Serhiy Storchaka2017-01-131-3/+3
| | | | is now positional-only.