[ python-Feature Requests-1198569 ] string.Template not flexible enough to subclass (regexes)

SourceForge.net noreply at sourceforge.net
Tue May 10 05:08:41 CEST 2005


Feature Requests item #1198569, was opened at 2005-05-09 15:55
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1198569&group_id=5470

>Category: Python Library
>Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Ian Bicking (ianbicking)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: string.Template not flexible enough to subclass (regexes)

Initial Comment:
The regular expressions in string.Template can be
overidden, but there's not an easy way to override the
expression for variables inside braces and to a
different expression than variables not in braces. 
E.g., you might allow full expressions in braces
(including arbitrary punctuation), but only normal
variable names outside.  An example of using this kind
of technique:

http://svn.colorstudy.com/home/ianb/recipes/sub_expr.py

So, in summary, idpattern should be split into two,
idpattern and bracepattern.  (Maybe a default of None
for bracepattern, and use idpattern if bracepattern is
None -- this would be backward compatible so that
overriding only idpattern will effect both)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1198569&group_id=5470


More information about the Python-bugs-list mailing list