Hello, The following information is provided by a documentation. https://pylint.pycqa.org/projects/astroid/en/latest/inference.html#crash-course-into-astroid-s-inference
“… astroid offers a relatively similar API to the builtin ast module, that is, you can do astroid.parse(string) to get an AST out of the given string: >>> tree = astroid.parse('a + b') … >>> print(tree.repr_tree()) … body=[Expr(value=BinOp( op='+', left=Name(name='a'), right=Name(name='b')))]) The repr_tree() is super useful to inspect how a tree actually looks. …” Another information is provided by a related documentation. https://docs.python.org/3/library/ast.html “… cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn …” I guess that the identifier at the beginning of such a line from the abstract grammar should be interpreted as a comparison operator. Additional command examples: > python3 >>> import astroid >>> tree = astroid.parse('x == y') >>> print(tree.repr_tree()) … body=[Expr(value=Compare( left=Name(name='x'), ops=[['==', Name(name='y')]]))]) >>> tree = astroid.parse('1 in (2, 3)') >>> print(tree.repr_tree()) … body=[Expr(value=Compare( left=Const(value=1), ops=[['in', Tuple( ctx=<Context.Load: 1>, elts=[Const(value=2), Const(value=3)])]]))]) Now I am looking for more documentation so that the astroid programming interface can be safely applied also together with the shown variations of data representations. How will the chances evolve to clarify the affected implementation details a bit more? Regards, Markus _______________________________________________ code-quality mailing list -- code-quality@python.org To unsubscribe send an email to code-quality-le...@python.org https://mail.python.org/mailman3/lists/code-quality.python.org/ Member address: arch...@mail-archive.com