On 13/02/17 00:11, Chris Angelico wrote:
Firstly, be aware that there's no such thing as a "raw string" - what
you have is a "raw string literal". It's a purely syntactic feature.

I do understand that. When I said "is raw"/"rawness", I am talking about what the _parser_ is doing. I don't think there's a "raw string object" ;)

The string "\t" gets shown in the repr as "\t". It is a string
consisting of one character, U+0009, a tab. The string r"\t" is shown
as "\\t" and consists of two characters, REVERSE SOLIDUS and LATIN
SMALL LETTER T. That might be why you think there's confusing stuff
happening :)

OK, so please explain one of my examples:

>>>>> r"hello \the" "worl\d" "\t"
>> 'hello \\theworl\\d\t'
>>
>> The initial string is raw. The following string adopts that (same as the
>> second example), but the _next_ string does not!

Why is the first string token parsed as a "raw" string, the second string token also parsed as a "raw" string (without the 'r' prefix), but the third string token NOT?

That's what I'm trying to point out.

E.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to