Barry A. Warsaw <ba...@python.org> added the comment:

Technically it *is* an API change since `flags` is a part of the public API.  
The documentation says:

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

This means if someone does subclass string.Template and changes the pattern to 
accept Unicode identifiers, then with this change they will also have to modify 
flags, whereas before they didn't.

It really wasn't ever the intention to allow non-ASCII identifiers, so this is 
probably safe in practice.  OTOH, making the change for performance reasons 
might be questionable, given that the regular expressions are compiled by the 
Template's metaclass, so unlikely to contribute significantly to overall 
performance wins.

----------

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

Reply via email to