Slice¶
- class astroid.nodes.Slice(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]¶
Bases:
NodeNG
Class representing an
ast.Slice
node.>>> import astroid >>> node = astroid.extract_node('things[1:3]') >>> node <Subscript l.1 at 0x7f23b2e71f60> >>> node.slice <Slice l.1 at 0x7f23b2e71e80>
- display_type() Literal['Slice'] [source]¶
A human readable type of this node.
- Returns:
The type of this node.
- igetattr(attrname: str, context: InferenceContext | None = None) Iterator[SuccessfulInferenceResult] [source]¶
Infer the possible values of the given attribute on the slice.
- Parameters:
attrname – The name of the attribute to infer.
- Returns:
The inferred possible values.