class documentation

class DictComp(ComprehensionScope): (source)

View In Hierarchy

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>
Method __init__
Method bool​_value Determine the boolean value of this node.
Method get​_children Undocumented
Method postinit Do some setup after initialisation.
Instance Variable generators The generators that are looped through.
Instance Variable key What produces the keys.
Instance Variable locals A map of the name of a local variable to the node defining the local.
Instance Variable value What produces the values.
Class Variable _astroid​_fields Undocumented
Class Variable _other​_other​_fields Undocumented

Inherited from LocalsDictNodeNG (via ComprehensionScope):

Method __contains__ Check if a local is defined in this scope.
Method __getitem__ The first node the defines the given local.
Method __iter__ Iterate over the names of locals defined in this scoped node.
Method add​_local​_node Append a child that should alter the locals of this scope node.
Method items Get the names of the locals and the node that defines the local.
Method keys The names of locals defined in this scoped node.
Method qname Get the 'qualified' name of the node.
Method scope The first parent node defining a new scope.
Method set​_local Define that the given name is declared in the given statement node.
Method values The nodes that define the locals in this scoped node.
Method _append​_node append a child, linking it in the tree
Method _scope​_lookup XXX method for interfacing the scope lookup

Inherited from LookupMixIn (via ComprehensionScope, LocalsDictNodeNG):

Method ilookup Lookup the inferred values of the given variable.
Method lookup Lookup where the given variable is assigned.
def __init__(self, lineno=None, col_offset=None, parent=None, *, end_lineno=None, end_col_offset=None): (source)
Parameters
lineno:int or NoneThe line that this node appears on in the source code.
col​_offset:int or NoneThe column that this node appears on in the source code.
parent:NodeNG or NoneThe parent node in the syntax tree.
end​_lineno:Optional[int]The last line this node appears on in the source code.
end​_col​_offset:Optional[int]The end column this node appears on in the source code. Note: This is after the last symbol.
def bool_value(self, context=None): (source)
Determine the boolean value of this node.
Returns
UninferableThe boolean value of this node. For a DictComp this is always Uninferable.
def get_children(self): (source)

Undocumented

def postinit(self, key=None, value=None, generators=None): (source)
Do some setup after initialisation.
Parameters
key:NodeNG or NoneWhat produces the keys.
value:NodeNG or NoneWhat produces the values.
generators:list(Comprehension) or NoneThe generators that are looped through.
generators: list = (source)
The generators that are looped through.
What produces the keys.
locals: dict = (source)
A map of the name of a local variable to the node defining the local.
value = (source)
What produces the values.
_astroid_fields: tuple[str, ...] = (source)

Undocumented

_other_other_fields: tuple[str, ...] = (source)

Undocumented