Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string.Template documentation incorrectly references "identifiers" #68539

Closed
tifv mannequin opened this issue Jun 1, 2015 · 4 comments
Closed

string.Template documentation incorrectly references "identifiers" #68539

tifv mannequin opened this issue Jun 1, 2015 · 4 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@tifv
Copy link
Mannequin

tifv mannequin commented Jun 1, 2015

BPO 24351
Nosy @warsaw, @taleinat, @tifv

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/warsaw'
closed_at = <Date 2015-06-09.18:27:19.090>
created_at = <Date 2015-06-01.19:05:07.872>
labels = ['docs']
title = 'string.Template documentation incorrectly references "identifiers"'
updated_at = <Date 2015-06-15.06:57:51.018>
user = 'https://github.com/tifv'

bugs.python.org fields:

activity = <Date 2015-06-15.06:57:51.018>
actor = 'Arfrever'
assignee = 'barry'
closed = True
closed_date = <Date 2015-06-09.18:27:19.090>
closer = 'barry'
components = ['Documentation']
creation = <Date 2015-06-01.19:05:07.872>
creator = 'july'
dependencies = []
files = []
hgrepos = []
issue_num = 24351
keywords = []
message_count = 4.0
messages = ['244607', '244871', '245071', '245080']
nosy_count = 5.0
nosy_names = ['barry', 'taleinat', 'july', 'docs@python', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue24351'
versions = ['Python 3.4', 'Python 3.5', 'Python 3.6']

@tifv
Copy link
Mannequin Author

tifv mannequin commented Jun 1, 2015

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.

@tifv tifv mannequin assigned docspython Jun 1, 2015
@tifv tifv mannequin added the docs Documentation in the Doc dir label Jun 1, 2015
@rhettinger rhettinger assigned warsaw and unassigned docspython Jun 5, 2015
@warsaw
Copy link
Member

warsaw commented Jun 5, 2015

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.
    "

@taleinat
Copy link
Contributor

taleinat commented Jun 9, 2015

+1 for keeping the current behavior and fixing the docs.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 9, 2015

New changeset 20bf84cd38bc by Barry Warsaw in branch '3.4':

New changeset 0fa48f581fe3 by Barry Warsaw in branch '3.5':

New changeset 1cdedc9a9e9f by Barry Warsaw in branch 'default':

@warsaw warsaw closed this as completed Jun 9, 2015
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants