Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17d5f47

Browse files
committed
- Issue #24351: Clarify what is meant by "identifier" in the context of
string.Template instances.
1 parent f330d53 commit 17d5f47

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

Doc/library/string.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,14 @@ Instead of the normal ``%``\ -based substitutions, Templates support ``$``\
640640
* ``$$`` is an escape; it is replaced with a single ``$``.
641641

642642
* ``$identifier`` names a substitution placeholder matching a mapping key of
643-
``"identifier"``. By default, ``"identifier"`` must spell a Python
644-
identifier. The first non-identifier character after the ``$`` character
645-
terminates this placeholder specification.
646-
647-
* ``${identifier}`` is equivalent to ``$identifier``. It is required when valid
648-
identifier characters follow the placeholder but are not part of the
643+
``"identifier"``. By default, ``"identifier"`` is restricted to any
644+
case-insensitive ASCII alphanumeric string (including underscores) that
645+
starts with an underscore or ASCII letter. The first non-identifier
646+
character after the ``$`` character terminates this placeholder
647+
specification.
648+
649+
* ``${identifier}`` is equivalent to ``$identifier``. It is required when
650+
valid identifier characters follow the placeholder but are not part of the
649651
placeholder, such as ``"${noun}ification"``.
650652

651653
Any other appearance of ``$`` in the string will result in a :exc:`ValueError`

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ C API
323323
Documentation
324324
-------------
325325

326+
- Issue #24351: Clarify what is meant by "identifier" in the context of
327+
string.Template instances.
328+
326329
- Issue #22155: Add File Handlers subsection with createfilehandler to tkinter
327330
doc. Remove obsolete example from FAQ. Patch by Martin Panter.
328331

0 commit comments

Comments
 (0)