Letter class in re

Antoon Pardon antoon.pardon at rece.vub.ac.be
Mon Mar 9 10:34:42 EDT 2015


Op 09-03-15 om 14:32 schreef Wolfgang Maier:

...

>
>> It seems odd that one should need such an ugly expression for
>> something that is
>> used rather frequently for parsing computer languages and the like.
>>
>
> There is str.isidentifier, which returns True if something is a valid
> identifier name:
>
> >>> '℮'.isidentifier()
> True

Which is not very usefull in a context of lexical analysis. I don't need to know
if a particular string is useful as an identifier, I want to know which parts of
a text are identifiers.




More information about the Python-list mailing list