[Python-Dev] Extracting variables from string.Template objects (original) (raw)
Aahz aahz at pythoncraft.com
Fri Jan 4 16:52:56 CET 2008
- Previous message: [Python-Dev] Extracting variables from string.Template objects
- Next message: [Python-Dev] Extracting variables from string.Template objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jan 04, 2008, Isaac Morland wrote:
I would like to add this as a method of string.Template, which I think amounts to changing "template" to "self" and putting it in the Template class in string.py rather than on its own. If the general idea is approved I would be happy to make a patch.
Make a patch regardless of whether you get any approval -- someone may later have a different opinion, and writing a patch records your work.
Also, on a related issue, does it make sense to scan the template string for invalid escape sequences in Template.init? For the applications I can imagine of string.Template, I would prefer to get an error upon creating the Template object rather than arbitrarily later when I try to .substitute with it.
No, create an is_valid() method at best.
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Weinberg's Second Law: If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
- Previous message: [Python-Dev] Extracting variables from string.Template objects
- Next message: [Python-Dev] Extracting variables from string.Template objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]