New submission from Thomas Jollans <t...@tjol.eu>:

string.Template matches a $identifier with the regex [_a-z][_a-z0-9]* and 
re.IGNORECASE. This matches S, ſ and s, but not ß. 
https://github.com/python/cpython/blob/master/Lib/string.py#L78 (this code came 
up on python-dev)

The docs specify "any case-insensitive ASCII alphanumeric string (including 
underscores) that starts with an underscore or ASCII letter.". This includes S 
and s, but neither ſ nor ß. 
https://docs.python.org/3/library/string.html#template-strings

The docs refer to PEP 292, which specifies "By default, 'identifier' must spell 
a Python identifier [...]" This includes S, ſ, s and ß. 
https://www.python.org/dev/peps/pep-0292/

It's not entirely clear what the correct behaviour is (probably accepting any 
Python identifier). In any case, the current behaviour of string.Template is a 
bit silly, but changing it might break stuff.

----------
components: Library (Lib)
messages: 303577
nosy: tjollans
priority: normal
severity: normal
status: open
title: string.Template: cods, docs and PEP all disagree on definition of 
identifier
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31669>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to