Python behaviour with unrecognized string escapes (was Re: imaplib.IMAP4: Bug in implementation)

Peter Hansen peter at engcorp.com
Wed Mar 17 13:06:22 EST 2004


Max M wrote:
> Oliver Kurz wrote:
> 
>  > I call the uid like this
>  >
>  > uid("STORE",uid,"+FLAGS(\SEEN)")
> 
> 
> Are you shure you don't mean::
> 
>     uid("STORE",uid,"+FLAGS(\\SEEN)")
> 
> You are trying to create a non-existent special character, escaping the 
> s in your example.
> 
> I am not quite shure how Python reacts to that.

Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)]
 >>> '\s'
'\\s'
 >>> '\\s'
'\\s'

Seems that it if it doesn't recognize the escape, the effect is the same 
as if you had escaped the escape character in the first place...

-Peter



More information about the Python-list mailing list