PyDocs

Nav

Python Language Services

ExceptHandler

ast

class
  • ExceptHandler(type, name, body)
ExceptHandler(expr? type, identifier? name, stmt* body)
1 Example
>>> print(ast.dump(ast.parse("""\
... try:
...     a + 1
... except TypeError:
...     pass
... """), indent=4))
Module(
    body=[
        Try(
            body=[
                Expr(
                    value=BinOp(
                        left=Name(id='a'),
                        op=Add(),
                        right=Constant(value=1)))],
            handlers=[
                ExceptHandler(
                    type=Name(id='TypeError'),
                    body=[
                        Pass()])])])
from the Python docs
See Also
No see-alsos for ast/ExceptHandler
0 Notes
No notes for ExceptHandler