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

  • twoframesperminute@mastodon.social
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    @sugar_in_your_tea Using asserts in any code except testing is frowned upon, afaik. You should use specific exceptions instead of vague unlabeled assertion errors.

    You also seem to think that you’re not allowed to use exception to communicate the fact a check failed. If that’s the case, you’re seriously underusing the power of exceptions.

    It sounds a lot to me like you don’t even want to use Python or think it shouldn’t be used for anything serious. Why then even argue about it?