Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing fails when file docstring uses double quotes #7

Open
tedmiston opened this issue Nov 17, 2015 · 0 comments
Open

Parsing fails when file docstring uses double quotes #7

tedmiston opened this issue Nov 17, 2015 · 0 comments

Comments

@tedmiston
Copy link

For example, running this file:

# coding: interpy

"""
File docstring.
"""

food = 'tacos'
print "my favorite food is #{food}"

result:

File "test.py", line 3
"""
^
IndentationError: unexpected indent

Though changing double quotes to single quotes will pass:

# coding: interpy

'''
File docstring.
'''

food = 'tacos'
print "my favorite food is #{food}"

result:

my favorite food is tacos

But this change is non-optimal because we should use double quotes per PEP 257:

For consistency, always use """triple double quotes""" around docstrings. Use r"""raw triple double quotes""" if you use any backslashes in your docstrings. For Unicode docstrings, use u"""Unicode triple-quoted strings""" .

I understand this is not necessarily a trivial change because you still must handle triple double quoted strings used in code properly. For example:

print """\
a
#{food}
b"""

result:

a
tacos
b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant