[Python-ideas] idea: Template.match function

Joe Strout joe at strout.net
Sat Oct 11 03:49:02 CEST 2008

On Oct 10, 2008, at 7:38 PM, Jared Grubb wrote:

> You can basically do this using regular expressions; it's not as  
> "pretty", but it does exactly the same thing

That's true; and you can use % to do the same thing as  
Template.substitute (though it's not as pretty).

The point is, we already have a very pretty Template class that does  
this operation in one direction; it ought to do it in the other  
direction too.  The fact that it doesn't is surprising to a newbie  
(speaking from personal experience there), and the equivalent 're'  
incantation is considerably harder to come up with -- even more so  
than using % is harder than Template.substitute.

- Joe

More information about the Python-ideas mailing list