Why not use string's .format? anatoly techtonik <techtonik@gmail.com> wrote:
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].
## 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
-- Sent from my Android phone with K-9 Mail. Please excuse my brevity.