[Python-Dev] Re: Alternative ImplementationforPEP292:SimpleString
Substitutions
Brett C.
bac at OCF.Berkeley.EDU
Sat Sep 11 07:22:12 CEST 2004
Raymond Hettinger wrote:
>>>* For someone who understands exactly what they are doing, perhaps
>
> $ma
>
>>>is the intended placeholder -- why force them to uses braces:
>>>${ma}ñana.
>>
>>It also makes it more difficult to document. IOW, right now the PEP
>
> and
>
>>the documentation say that the first non-identifier character
>
> terminates
>
>>the placeholder. How would you word the rules with your change?
>
>
> """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.
>
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.
-Brett
More information about the Python-Dev
mailing list