Код: Выделить всё
def func(x):
"""Function docstring."""
result = x + 1
if result > 0:
# comment 2
return result
else:
# comment 3
return -1 * result
Код: Выделить всё
> trace(func(2))
Function docstring.
comment 2
comment 3
Что можно использовать? Насколько я понимаю, AST не сохраняет комментарии в дереве.
Подробнее здесь: https://stackoverflow.com/questions/483 ... ution-path