[Python-Dev] Re: Re: Alternative ImplementationforPEP292:SimpleStringSubstitutions (original) (raw)
Fredrik Lundh fredrik at pythonware.com
Sat Sep 11 08:52:06 CEST 2004
- Previous message: [Python-Dev] Re: Alternative ImplementationforPEP292:SimpleString Substitutions
- Next message: [Python-Dev] Re: Alternative ImplementationforPEP292:SimpleString Substitutions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
so why keep the python identifier limitation? the RE engine you're using to parse the template has a concept of "alphanumeric character". just define the placeholder syntax as "one or more alphanumeric characters or under- scores" (\w+), use re.UNICODE if the template is created from a unicode string, and you're done.
this doesn't mean that people have to use non-ASCII characters, of course. but if they do, things just work.
- Previous message: [Python-Dev] Re: Alternative ImplementationforPEP292:SimpleString Substitutions
- Next message: [Python-Dev] Re: Alternative ImplementationforPEP292:SimpleString Substitutions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]