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:
NodeNGClass representing an
ast.Comparenode.A
Comparenode indicates a comparison.>>> import astroid >>> node = astroid.extract_node('a <= b <= c') >>> node <Compare l.1 at 0x...> >>> node.ops [('<=', <Name.b l.1 at 0x...>), ('<=', <Name.c l.1 at 0x...>)]
- 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:
Iterator[NodeNG]