Changes by Dmitry Kazakov jsb...@gmail.com:
--
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24309
___
___
Python-bugs-list
Serhiy Storchaka added the comment:
Agree with Barry. And please note, that string.Template is not invented in
Python, it is used in a lot of other languages, including shell, make, Tcl,
Perl. One of the advantage is that these templates are cross-language.
--
Barry A. Warsaw added the comment:
So yeah, we don't want to deprecate string.Template. It has a very specific
use case that's used a lot, i.e. making strings dead simple to translate.
%(foo)s was very problematic. {foo} is a little better, but looks too weird
for most translators. $foo
Roundup Robot added the comment:
New changeset 678a76610723 by Serhiy Storchaka in branch 'default':
Issue #24309: Removed Python 2 idioms.
https://hg.python.org/cpython/rev/678a76610723
--
nosy: +python-dev
___
Python tracker rep...@bugs.python.org
R. David Murray added the comment:
Yes, I'm sure there is a lot of code that uses string.Template, partly because
I've used it in at least three different projects for three different customers
;)
If you are willing to write a patch that might get superseded by Serhiy's code
(if he decides
New submission from Dmitry Kazakov:
I came across this piece of code in Lib/string.py:146:
# We use this idiom instead of str() because the latter will
# fail if val is a Unicode containing non-ASCII characters.
return '%s' % (mapping[named],)
This seems vestigial. I think it'd be
Serhiy Storchaka added the comment:
I'm strongly -1 for deprecating string.Template. It provides simple, widely
used syntax, and is used in a lot of third-party code. I don't think that it
needs to be extended.
However I have an idea about implementing general string composing engine than
Raymond Hettinger added the comment:
I came across this piece of code in Lib/string.py:146:
That may be artifact from the days of ASCII strings and may or may not have
analog with the bytes data type.
But I'm not exactly sure string.Template should be in
Python 3 at all.
It still has
Dmitry Kazakov added the comment:
Ugh, I guess I was too quick to propose deprecation, sorry :(
But is it a strict No to the proposed use of str.format as well? This would
be a (relatively) minor but useful change which, again, won't break anything.
I can write the patch.
--