[Python-Dev] Re: Alternative ImplementationforPEP292:SimpleString Substitutions

Shane Holloway (IEEE) shane.holloway at ieee.org
Sat Sep 11 08:25:49 CEST 2004


> Raymond Hettinger wrote:
>> """Placeholders must be a valid Python identifier (containing only ASCII
>> alphanumeric characters and an underscore).  If an unbraced identifier
>> ends with a non-ASCII alphanumeric character, such as the latin letter n
>> with tilde in $mañana, then a ValueError is raised for the specious
>> identifier.

Brett C. wrote:
> I don't think any of this is needed.  If a non-programmer is being told 
> to use string substitution chances are someone is either going to 
> explain it to them or there will be another set of docs to explain 
> things in a simple way.  I suspect stating exactly what a valid Python 
> identifier contains as you did in parentheses above will be enough.

Also, since Barry has gone to great lengths to make Template 
overrideable, applications can replace the regular expression in their 
derived Template class when there is a need to allow for end-users 
inputing template strings.  So, I'd suggest keeping safe_substitute 
relatively simple, but document the limitation and/or solution.

Thanks,
-Shane Holloway



More information about the Python-Dev mailing list