homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author carsten.klein@axn-software.de
Recipients carsten.klein@axn-software.de
Date 2012年12月29日.00:08:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356739702.66.0.625233113719.issue16806@psf.upfronthosting.co.za>
In-reply-to
Content
Given an input module such as
class klass(object):
 """multi line comment
 continued on this line
 """
 """single line comment"""
 """
 Another multi
 line
 comment"""
and implementing a custom ast.NodeVisitor such as
import as
class CustomVisitor(ast.NodeVisitor):
 def visit_ClassDef(self, node):
 for childNode in node.body:
 self.visit(childNode)
 def visit_Expr(self, node):
 print(node.col_offset)
 print(node.value.col_offset)
and feeding it the compiled ast from the module above
f = open('./module.py')
source = f.read()
node = ast.parse(source, mode = 'exec')
visitor = CustomVisitor()
visitor.visit(node)
should yield -1/-1 for the docstring that is the first
child node expression of the classdef body.
it will, however, yield the correct col_offset of 4/4 for
the single line docstring following the first one.
the multi line docstring following that will again
yield a -1/-1 col_offset.
It believe that this behaviour is not correct and instead
the col_offset should be 4 for both the expression node
and its str value.
History
Date User Action Args
2012年12月29日 00:08:22carsten.klein@axn-software.desetrecipients: + carsten.klein@axn-software.de
2012年12月29日 00:08:22carsten.klein@axn-software.desetmessageid: <1356739702.66.0.625233113719.issue16806@psf.upfronthosting.co.za>
2012年12月29日 00:08:22carsten.klein@axn-software.delinkissue16806 messages
2012年12月29日 00:08:21carsten.klein@axn-software.decreate

AltStyle によって変換されたページ (->オリジナル) /