http://docs.python.org/2/library/string.html#template-strings
## Original Idea
stdlib lacks the most popular basic variable extension syntax "{{ variable }}" that can be found in Django [1], Jinja2 [2] and other templating engines [3]. Anatoly, you've been participating here long enough to know that an important question to answer is: why does the stdlib need this functionality? As you point out here, it is already available from
On 11/28/13 11:57 AM, anatoly techtonik wrote: popular third-party packages. Why not just let them provide the functionality, and leave it at that? --Ned.
## stdlib Analysis
string.Template syntax is ancient (dates back to Python 2.4 from 9 years ago). I haven't seen a template like this for a long time.
## Scope of Enhancement
st = 'Hello {{world}}.' world = 'is not enough' t = Template(string, style='brace') t.render(locals())
## Links
1. https://docs.djangoproject.com/en/dev/topics/templates/#variables 2. http://jinja.pocoo.org/docs/templates/#variables 3. http://mustache.github.io/
## Feature Creeping
# Allow to override {{ }} symbols to make it more generic.
# `foo.bar` attribute lookup for 2D (nested) structures.
Questions is it has to be supported: `foo.bar` in Django does dictionary lookup first, then attribute lookup `foo.bar` in Jinja2 does attribute lookup first
I am not sure which is better. I definitely don't want some method or property on a dict passed to render() method to hide dict value. -- anatoly t. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas