A proposal for java's "throws" in python: Extend type hints to cover exceptions - eviltoast

This is a discussion on Python’s forums about adding something akin to a throws keyword in python.

  • CodeMonkey@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    I also like checked exceptions. I like having a compile time check that I thought through error scenarios.

    Is it perfect? No, but it should be iterated upon, not discarded.

    FYI, catching and rethrowing as an unchecked exception is a pretty bad anti-patern (and a foul code smell).