summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2015-06-09 18:20:31 (GMT)
committerBarry Warsaw <barry@python.org>2015-06-09 18:20:31 (GMT)
commit17d5f474238fc753bf4d28d458784a0e2e6d3cd9 (patch)
tree6b0299f8bf3bb5df7ffdb3af59f60124bb894cc7
parentf330d536910735ffa54f0fab136c04dbd0ee49dd (diff)
downloadcpython-17d5f474238fc753bf4d28d458784a0e2e6d3cd9.zip
cpython-17d5f474238fc753bf4d28d458784a0e2e6d3cd9.tar.gz
cpython-17d5f474238fc753bf4d28d458784a0e2e6d3cd9.tar.bz2
- Issue #24351: Clarify what is meant by "identifier" in the context of
string.Template instances.
-rw-r--r--Doc/library/string.rst14
-rw-r--r--Misc/NEWS3
2 files changed, 11 insertions, 6 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index f9da5fa..19bdb21 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -640,12 +640,14 @@ Instead of the normal ``%``\ -based substitutions, Templates support ``$``\
* ``$$`` is an escape; it is replaced with a single ``$``.
* ``$identifier`` names a substitution placeholder matching a mapping key of
- ``"identifier"``. By default, ``"identifier"`` must spell a Python
- identifier. The first non-identifier character after the ``$`` character
- terminates this placeholder specification.
-
-* ``${identifier}`` is equivalent to ``$identifier``. It is required when valid
- identifier characters follow the placeholder but are not part of the
+ ``"identifier"``. By default, ``"identifier"`` is restricted to any
+ case-insensitive ASCII alphanumeric string (including underscores) that
+ starts with an underscore or ASCII letter. The first non-identifier
+ character after the ``$`` character terminates this placeholder
+ specification.
+
+* ``${identifier}`` is equivalent to ``$identifier``. It is required when
+ valid identifier characters follow the placeholder but are not part of the
placeholder, such as ``"${noun}ification"``.
Any other appearance of ``$`` in the string will result in a :exc:`ValueError`
diff --git a/Misc/NEWS b/Misc/NEWS
index dada469..b2f4960 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -323,6 +323,9 @@ C API
Documentation
-------------
+- Issue #24351: Clarify what is meant by "identifier" in the context of
+ string.Template instances.
+
- Issue #22155: Add File Handlers subsection with createfilehandler to tkinter
doc. Remove obsolete example from FAQ. Patch by Martin Panter.