class documentation

class _ListComp(node_classes.NodeNG): (source)

Known subclasses: astroid.nodes.scoped_nodes.ListComp

View In Hierarchy

Class representing an ast.ListComp node.

>>> import astroid
>>> node = astroid.extract_node('[thing for thing in things if thing]')
>>> node
<ListComp l.1 at 0x7f23b2e418d0>
Method bool​_value Determine the boolean value of this node.
Method get​_children Undocumented
Method postinit Do some setup after initialisation.
Instance Variable elt The element that forms the output of the expression.
Instance Variable generators The generators that are looped through.
Class Variable _astroid​_fields Undocumented
def bool_value(self, context=None): (source)
Determine the boolean value of this node.
Returns
UninferableThe boolean value of this node. For a ListComp this is always Uninferable.
def get_children(self): (source)

Undocumented

def postinit(self, elt=None, generators=None): (source)
Do some setup after initialisation.
Parameters
elt:NodeNG or NoneThe element that forms the output of the expression.
generators:list(Comprehension) or NoneThe generators that are looped through.
The element that forms the output of the expression.
generators = (source)
The generators that are looped through.
_astroid_fields: tuple[str, ...] = (source)

Undocumented