![]() |
|
|
|
#1 |
|
Hello,
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) and that the line above should be: cls.pattern = _re.compile(pattern, _re.VERBOSE) and the default value for idpattern: [_a-zA-Z][_a-zA-Z0-9]* Do you agree on this? Is there any reason for the IGNORECASE option to be passed to re.compile? Best regards, Javier Javier Collado |
|
|
|
|
#2 |
|
Posts: n/a
|
In article <mailman.3938.1248942327.8015.python->,
Javier Collado <> 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 () <*> 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 Aahz |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Digital DIGEST - LIVE UPDATE Issue 41 | Ablang | DVD Video | 0 | 01-05-2004 11:54 PM |
| Re: odd motherboard issue | hootnholler | A+ Certification | 0 | 12-19-2003 06:34 AM |
| Digital DIGEST - LIVE UPDATE Issue 40 | Ablang | DVD Video | 0 | 12-15-2003 02:45 PM |
| Digital DIGEST - LIVE UPDATE Issue 39 | Ablang | DVD Video | 0 | 11-29-2003 02:17 AM |
| Digital DIGEST - LIVE UPDATE Issue 38 | Ablang | DVD Video | 0 | 11-09-2003 01:31 AM |