PyDocs

Nav

Python Language Services

For

ast

class
  • For(target, iter, body, orelse, type_comment)
For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
Members of For

t

type_comment
type_comment is an optional string with the type annotation as a comment.
1 Example
>>> print(ast.dump(ast.parse("""
... for x in y:
...     ...
... else:
...     ...
... """), indent=4))
Module(
    body=[
        For(
            target=Name(id='x', ctx=Store()),
            iter=Name(id='y'),
            body=[
                Expr(
                    value=Constant(value=Ellipsis))],
            orelse=[
                Expr(
                    value=Constant(value=Ellipsis))])])
from the Python docs
See Also
No see-alsos for ast/For
0 Notes
No notes for For