Py-dea: Streamline string literals now!

Lie Ryan lie.1296 at gmail.com
Wed Dec 28 15:53:39 EST 2011


On 12/28/2011 04:34 PM, Rick Johnson wrote:
> On Dec 27, 9:49 pm, Rick Johnson<rantingrickjohn... at gmail.com>  wrote:
>
>> The fact is...even with the multi-line issue solved, we still have two
>> forms of literal delimiters that encompass two characters resulting in
>> *four* possible legal combinations of the exact same string! I don't
>> know about you guys, but i am not a big fan of Tim Towtdi.
>
> actually i was a bit hasty with that statment and underestimated the
> actual number of possiblities.
>
> 1) "this is a string"
> 2) 'this is a string'
> 3) r"this is a string"
> 4) r'this is a string'
> 5) '''this is a string'''
> 6) """this is a string"""
> 7) r'''this is a string'''
> 8) r"""this is a string"""

you missed u"nicode" string and b"yte" string, each of them available in 
both single and double quote flavor and single and triple quote flavor. 
Also, it's possible to mix them together ur"unicode raw string" or 
br"byte raw string", they are also in single and double quote flavor and 
single and triple quote flavor. And of course, I can't believe you 
forget Guido's favourite version, g"", available in musical and sirloin 
cloth flavor.




More information about the Python-list mailing list