Hi Collin,

> > Oh, this means that r'[x\$]' contains dollar and backslash, whereas the
> > programmer might have thought that it contains only the dollar? Indeed,
> > it's worth to listen to these warnings!
> 
> I don't think it changes the meaning:
> 
>     import re
>     re.match(r'[x$]*', 'x\\$').group()
>     'x'
>     re.match(r'[x\$]*', 'x\\$').group()
>     'x'
>     re.match(r'[x\\$]*', 'x\\$').group()
>     'x\\$'

Oh, so it's not as bad as I thought. I had taken your statement

  "And in the set the special characters have their special meaning dropped,
   so there is no need to backslash them."

at face value, and got confused. Actually the correct statement is

  "And in the set the special characters, other than backslash, have their
   special meaning dropped,
   so there is no need to backslash them."

Bruno




Reply via email to