Subscript

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

Bases: NodeNG

Class representing an ast.Subscript node.

>>> import astroid
>>> node = astroid.extract_node('things[1:3]')
>>> node
<Subscript l.1 at 0x7f23b2e71f60>
ctx

Whether the subscripted item is assigned to or loaded from.

get_children()[source]

Get the child nodes below this node.

infer_lhs(**kwargs: _P.kwargs) Generator[InferenceResult, None, None]
postinit(value: NodeNG, slice: NodeNG) None[source]
slice: NodeNG

The slice being used to lookup.

value: NodeNG

What is being indexed.