DictComp#

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

Bases: ComprehensionScope

Class representing an ast.DictComp node.

>>> import astroid
>>> node = astroid.extract_node('{k:v for k, v in things if k > v}')
>>> node
<DictComp l.1 at 0x7f23b2e41d68>
bool_value(context: InferenceContext | None = None)[source]#

Determine the boolean value of this node.

Returns:

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

Return type:

Uninferable

get_children()[source]#

Get the child nodes below this node.

key: NodeNG#

What produces the keys.

locals: dict[str, list[InferenceResult]]#

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

postinit(key: NodeNG, value: NodeNG, generators: list[nodes.Comprehension]) None[source]#
value: NodeNG#

What produces the values.