[issue19824] string.Template: Add PHP-style variable expansion example

anatoly techtonik report at bugs.python.org
Thu Nov 28 21:00:36 CET 2013


anatoly techtonik added the comment:

@Alex, have you seen http://pythonhosted.org/flufl.i18n/docs/using.html#substitutions-and-placeholders? I really like the brevity, and it is the function that does the magic, so it is fully transparent and you don't need to instantiate string.Template every time. I think its awesome.

Do you have some explanations why passing locals() to string.Template is anti-pattern? I understand that passing "all that you have" is not good, but from my past experience with PHP I can't remember any problems that there are more names than I used. It is templating after all - what do you want to protect from?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19824>
_______________________________________


More information about the Python-bugs-list mailing list