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

Bases: BaseContainer

Class representing an ast.Tuple node.

>>> import astroid
>>> node = astroid.extract_node('(1, 2, 3)')
>>> node
<Tuple.tuple l.1 at 0x7f23b2e41780>
assigned_stmts(node: node_classes.AssignedStmtsPossibleNode = None, context: InferenceContext | None = None, assign_path: list[int] | None = None) Any#

Returns the assigned statement (non inferred) according to the assignment type. See astroid/protocols.py for actual implementation.

ctx: Context | None#

Whether the tuple is assigned to or loaded from.

getitem(index, context: InferenceContext | None = None)[source]#

Get an item from this node.


index (Const or Slice) – The node to use as a subscript index.

infer_binary_op(**kwargs: _P.kwargs) Generator[InferenceResult, None, None]#
pytype() Literal['builtins.tuple'][source]#

Get the name of the type that this node represents.


The name of the type.