homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: string.Template documentation incorrectly references "identifiers"
Type: Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, docs@python, july, python-dev, taleinat
Priority: normal Keywords:

Created on 2015年06月01日 19:05 by july, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Messages (4)
msg244607 - (view) Author: July Tikhonov (july) * Date: 2015年06月01日 19:05
Documentation of Template says:
$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.
While it was true when these lines were written, Python 3 has greatly extended identifier character set, and it no longer matches the set of characters used by Template:
>>> Template('$foo123щъ').substitute(foo=1, foo123=2, foo123щъ=3)
'2щъ'
I propose clarifying documentation.
Actually extending character set is backward-incompatible, although it won't be if restricted to "${identifier}" syntax.
msg244871 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2015年06月05日 16:45
Rather than change the code, which strives to keep the "Simple" in PEP 292's title, I'd rather just update the documentation to define what "identifier" means here. E.g.
"
* ``$identifier`` names a substitution placeholder matching a mapping key of
 ``"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.
"
msg245071 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2015年06月09日 16:02
+1 for keeping the current behavior and fixing the docs.
msg245080 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015年06月09日 18:24
New changeset 20bf84cd38bc by Barry Warsaw in branch '3.4':
- Issue #24351: Clarify what is meant by "identifier" in the context of
https://hg.python.org/cpython/rev/20bf84cd38bc
New changeset 0fa48f581fe3 by Barry Warsaw in branch '3.5':
- Issue #24351: Clarify what is meant by "identifier" in the context of
https://hg.python.org/cpython/rev/0fa48f581fe3
New changeset 1cdedc9a9e9f by Barry Warsaw in branch 'default':
- Issue #24351: Clarify what is meant by "identifier" in the context of
https://hg.python.org/cpython/rev/1cdedc9a9e9f 
History
Date User Action Args
2022年04月11日 14:58:17adminsetgithub: 68539
2015年06月15日 06:57:51Arfreversetstage: needs patch -> resolved
2015年06月09日 18:27:19barrysetstatus: open -> closed
resolution: fixed
2015年06月09日 18:24:47python-devsetnosy: + python-dev
messages: + msg245080
2015年06月09日 16:02:59taleinatsetnosy: + taleinat
messages: + msg245071
2015年06月05日 16:46:00barrysetmessages: + msg244871
2015年06月05日 02:28:45rhettingersetassignee: docs@python -> barry

nosy: + barry
2015年06月01日 20:18:45serhiy.storchakasetstage: needs patch
2015年06月01日 19:05:07julycreate

AltStyle によって変換されたページ (->オリジナル) /