[New-bugs-announce] [issue17078] string.Template.safe_substitute hard-wires "braces" as {}

Adam Kellas report at bugs.python.org
Tue Jan 29 22:30:46 CET 2013

New submission from Adam Kellas:

If you use safe_substitute and try to use a variable reference style other than ${foo}, you will find that it assumes ${foo} style. In particular, when evaluating $[foo] (square braces) and 'foo' is not defined, safe_substitute will put the string back together using ${foo} (curly braces).

See <http://stackoverflow.com/questions/14573230/pythons-string-template-changes-brackets-when-variable-is-unset> for details and test case.

components: Library (Lib)
messages: 180949
nosy: Adam.Kellas
priority: normal
severity: normal
status: open
title: string.Template.safe_substitute hard-wires "braces" as {}
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list