class astroid.nodes.SetComp(lineno: int, col_offset: int, parent: NodeNG, *, end_lineno: int | None, end_col_offset: int | None)[source]

Bases: ComprehensionScope

Class representing an ast.SetComp node.

>>> import astroid
>>> node = astroid.extract_node('{thing for thing in things if thing}')
>>> node
<SetComp l.1 at 0x7f23b2e41898>
bool_value(context: InferenceContext | None = None)[source]

Determine the boolean value of this node.


The boolean value of this node. For a SetComp this is always Uninferable.

Return type:


elt: NodeNG

The element that forms the output of the expression.

generators: list[nodes.Comprehension]

The generators that are looped through.


Get the child nodes below this node.

locals: dict[str, list[InferenceResult]]

A map of the name of a local variable to the node defining the local.

postinit(elt: NodeNG, generators: list[nodes.Comprehension]) None[source]