For¶
- class astroid.nodes.For(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]¶
Bases:
MultiLineWithElseBlockNode
,AssignTypeNode
,Statement
Class representing an
ast.For
node.>>> import astroid >>> node = astroid.extract_node('for thing in things: print(thing)') >>> node <For l.1 at 0x7f23b2e8cf28>
- assigned_stmts(**kwargs: _P.kwargs) Generator[InferenceResult] ¶
Returns the assigned statement (non inferred) according to the assignment type. See astroid/protocols.py for actual implementation.
- optional_assign: ClassVar[bool] = True¶
Whether this node optionally assigns a variable.
This is always
True
forFor
nodes.