Message244326
| Author |
barry |
| Recipients |
barry, r.david.murray, rhettinger, serhiy.storchaka, vaultah |
| Date |
2015年05月28日.17:37:04 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1432834624.74.0.0722113397205.issue24309@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 is very common, well understood, and hard to get wrong.
As for modernizing the code (the L146 bit was thanks to Python 2), I wouldn't be against it if it doesn't change the documented API or functionality and all the tests still pass (and there's good coverage - I don't remember anymore). I don't think it's really that important though; typically these are not used in performance critical sections.
Re: ${thing.attribute} - no, that wouldn't keep them Simple and PEP 292 was deliberately targeting simplicity.
Bottom line: keep $-strings simple and focused on their original use case. For more complicated use cases, use str.format(). |
|