Py-dea: Streamline string literals now!

Lie Ryan lie.1296 at gmail.com
Wed Dec 28 15:13:17 EST 2011


On 12/29/2011 06:36 AM, Rick Johnson wrote:
>
> mlstr = |||
> this is a
> multi line sting that is
> delimited by "triple pipes". Or we
> could just 'single pipes' if we like, however, i think
> the "triple pipe' is easier to see. Since the pipe char
> is so rare in Python source, it becomes the obvious
> choice. And, best of all, no more worries about
> "embedded quotes". YAY!
> |||
>
> slstr = |this is a single line string|
>
> The point is people, we should be using string delimiters that are
> ANYTHING besides " and '. Stop being a sheep and use your brain!

This will incur the wrath of all linux/unix sysadmins all over the 
world. You are just replacing one problem with another; in your 
obliviousness, you had just missed the very obvious fact that once you 
replace quotes with pipes, quotes is extremely rare in Python (in fact 
you won't be seeing any quotes except inside string literals).




More information about the Python-list mailing list