string.Template issue

Aahz aahz at pythoncraft.com
Sat Aug 1 19:36:58 EDT 2009


In article <mailman.3938.1248942327.8015.python-list at python.org>,
Javier Collado  <javier.collado at gmail.com> wrote:
>
>In the string.Template documentation
>(http://docs.python.org/library/string.html) it's explained that if a
>custom regular expression for pattern substitution is needed, it's
>possible to override idpattern class attribute (whose default value is
>[_a-z][_a-z0-9]*).
>
>However, if the custom pattern that is needed is just uppercase
>letters something like [A-Z]+ won't work because of the following line
>in the _TemplateMetaclass class __init__ method:
>cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE)
>
>I would say that this is an error (IGNORECASE just shouldn't be there)

Good point!  I don't have an answer for you, but please file a report at
bugs.python.org to make sure it doesn't get lost.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer



More information about the Python-list mailing list