GeneratorExp¶
- class astroid.nodes.GeneratorExp(lineno: int, col_offset: int, parent: NodeNG, *, end_lineno: int | None, end_col_offset: int | None)[source]¶
Bases:
ComprehensionScopeClass representing an
ast.GeneratorExpnode.>>> import astroid >>> node = astroid.extract_node('(thing for thing in things if thing)') >>> node <GeneratorExp l.1 at 0x7f23b2e4e400>
- bool_value(context: InferenceContext | None = None) Literal[True][source]¶
Determine the boolean value of this node.
- Returns:
The boolean value of this node. For a
GeneratorExpthis is alwaysTrue.
- generators: list[nodes.Comprehension]¶
The generators that are looped through.