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

Skip to content

Commit 9380acb

Browse files
committed
- Issue #24351: Clarify what is meant by "identifier" in the context of
string.Template instances.
2 parents 86a60bf + 17d5f47 commit 9380acb

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

Doc/library/string.rst

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

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

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

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ Tests
4545
tp_finalize to avoid reference leaks encountered when combining tp_dealloc
4646
with PyType_FromSpec (see issue #16690 for details)
4747

48+
Documentation
49+
-------------
50+
51+
- Issue #24351: Clarify what is meant by "identifier" in the context of
52+
string.Template instances.
53+
4854

4955
What's New in Python 3.5.0 beta 2?
5056
==================================

0 commit comments

Comments
 (0)