Skip to content

Instantly share code, notes, and snippets.

@priestc priestc/gist:5897602

Last active Dec 19, 2015
Embed
What would you like to do?
def myfunction(arg1, arg2):
"""
The Docstring.
"""
for x in range(500):
print """This multiline string makes the code look ugly.
I wish there were some way to
write this string in such a way that looks better.
I could add spaces at the front of each line in this string,
but if I do that, my string is polluted with big swaths of space characters.
This function's docstring suffers from this problem.
The way I have the docstring formatted, the first character is a newline character.
In some cases, this could cause bugs.
"""
def myfunction2(arg1, arg2):
```
This is a fancy multiline quote. Newlines and
big swaths of 'indentation count' space/tab chars
within strings are automatically removed.
```
for x in range(500):
print ```
Now my code looks much better. The output of this
function is as if you had written it in the same way
its written in the code above, except with all newlines
replaced with spaces and big swaths of spaces removed.
```
>>> myfunction2(1, 2):
Now my code looks much better. The output of this function is as if you had written it in the same way its written in the code above, except with all newlines replaced with spaces and big swaths of spaces removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.