escape sequences and string comparisons

jkndeja at my-deja.com jkndeja at my-deja.com
Tue Jan 9 04:30:46 EST 2001


OK, my question is being purified ;-) into the following:

When, in a string, an escape character '\' is followed by a character
which is not in the list of 'characters forming escape sequences', the
behaviour of Python is that both the backslash and the following
character are kept in the string.

My copy of K & R C (2nd Ed, Sec A2.5.2) says 'if the character
following the \ is not one of those specified, the behaviour is
undefined'

My copy of 'The C Reference Manual' (Harbison and Steele), says
(paraphrased) '... the behaviour is undefined, though traditionally the
effect is simply that the backslash is ignored'.

My question - is there a good reason that Python has moved from this
'traditional' effect, which seems to me to be a useful one, for
instance in the context of my original question? Would this behaviour
have broken something else? Shall I raise a PEP? ;-)

    Regards
    Jon N


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list