Keith Devens .com |
Thursday, March 18, 2010 | ![]() |
| Follow the path. – me | ||
|
| ← magpiebrain - A comparison of Django with Rails | Join Java, concurrency extensions to Java → |

quackeroo wrote:
Keith (http://keithdevens.com/) wrote:
Hey, thanks. I updated the main post. I need to find a link to the Ruby documentation for that so I can link it too...
quackeroo wrote:
Hmm. Can't find any good direct links. It's in the PickAxe on this page under the Strings section, though.
joesb wrote:
In Python case it doesn't look like heredoc to me.
How do you represent """ in Python's heredoc without escaping it?
Keith (http://keithdevens.com/) wrote:
How do you represent """ in Python's heredoc without escaping it?
You don't. You need to escape one of the quotes. But how does that make it not like heredoc?
How do you represent "EOF" at the beginning of a line in the Perl heredoc? You don't. You'd have to choose a different delimiter. The Python triple-quoted strings, in comparison, can represent all possible strings.
81.56.229.109 wrote:
joesb is right. what makes heredoc syntax appart is that you nether have to quote anything inside the text. you just have to choose your delimiters so that they do not occur in the textual content.
Python's triple quoting is just a like single quoting, but the delimiter being longuer, you'r less likely to find it in the text, so you have less odds to need escaping.
one could design a language where text is enclosed by 'WAZAA!!TEXT_HERE'put you text here'WAZAA!!TEXT_HERE', that's not heredoc syntax.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):
Generated in about 0.102s.
(Used 8 db queries)
And in Ruby:
str = <<EOF
text goes here
EOF