]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-46307: Add string.Template.get_identifiers() method (GH-30493)
authorBen Kehoe <bkehoe@irobot.com>
Tue, 11 Jan 2022 19:15:42 +0000 (12:15 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Jan 2022 19:15:42 +0000 (11:15 -0800)
commitdce642f24418c58e67fa31a686575c980c31dd37
tree90e9eb86f921027c33819c29490de8be68990b56
parentcf496d657a1a82eaf9ebfb47d721676fef6effa5
bpo-46307: Add string.Template.get_identifiers() method (GH-30493)

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
Doc/library/string.rst
Lib/string.py
Lib/test/test_string.py
Misc/NEWS.d/next/Library/2022-01-10-07-51-43.bpo-46307.SKvOIY.rst [new file with mode: 0644]