Compare¶
- class astroid.nodes.Compare(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]¶
Bases:
NodeNG
Class representing an
ast.Compare
node.A
Compare
node indicates a comparison.>>> import astroid >>> node = astroid.extract_node('a <= b <= c') >>> node <Compare l.1 at 0x7f23b2e9e6d8> >>> node.ops [('<=', <Name.b l.1 at 0x7f23b2e9e2b0>), ('<=', <Name.c l.1 at 0x7f23b2e9e390>)]
- get_children()[source]¶
Get the child nodes below this node.
Overridden to handle the tuple fields and skip returning the operator strings.
- Returns:
The children.
- Return type:
iterable(NodeNG)