Message294654
Since #29463, it is no longer obvious how to get the line number of a docstring in the AST:
import ast
x = ast.parse('''\
def foo():
"""This is a docstring."""
''')
# In Python 3.6, the docstring and line number would be:
print(x.body[0].body[0].value.s)
print(x.body[0].body[0].value.lineno)
# In Python 3.7, I don't know what the equivalent would be.
print(x.body[0].docstring)
# Line number?
We use this feature in pyflakes (https://github.com/PyCQA/pyflakes/issues/271). |
|
Date |
User |
Action |
Args |
2017-05-28 18:44:26 | myint | set | recipients:
+ myint |
2017-05-28 18:44:26 | myint | set | messageid: <1495997066.31.0.794903121268.issue30497@psf.upfronthosting.co.za> |
2017-05-28 18:44:26 | myint | link | issue30497 messages |
2017-05-28 18:44:26 | myint | create | |
|