r"string" vs R"string

Colin W. cjwilliams43 at gmail.com
Mon Jan 18 14:01:28 CET 2010


On 17-Jan-10 18:27 PM, Steven D'Aprano wrote:
> On Sun, 17 Jan 2010 11:13:48 -0500, Roy Smith wrote:
>
>> In article<hiv4c6$5l8$1 at theodyn.ncf.ca>,
>>   "Colin W."<cjwilliams43 at gmail.com>  wrote:
>>
>>> On 17-Jan-10 02:16 AM, Terry Reedy wrote:
>>>> On 1/17/2010 1:55 AM, Brendan Miller wrote:
>>>>> Is there any difference whatsoever between a raw string beginning
>>>>> with the captical R or one with the lower case r e.g. r"string" vs
>>>>> R"string"?
>>>>
>>>> No. Nor is there and difference between the strings created with raw
>>>> literals and cooked literals.
>>>>
>>>>
>>> "cooked" literal  ??
>>
>> I've never seen it referred to this way in the Python literature, but
>> "cooked" is a well-known term meaning, "not raw".  The usage goes back
>> decades.
>
> I think the use of "cooked" meaning "not raw" goes back a little bit more
> than decades. The verb "to cook" dates from the late 14th century, and
> the adjective form "cooked" would follow soon after. The use of "cooked"
> to mean manipulated (as in "cooking the books") comes from the 1630s.
> Extending it to strings (as in raw versus cooked strings) is an obvious
> extension.
>
Yes, I should have cottoned on, but perhaps "... between the strings, 
raw and other." would have conveyed the idea.

Colin W.



More information about the Python-list mailing list