• @kersplomp@programming.dev
    link
    fedilink
    12 months ago

    I see your concern, but in practice that’s not what happens in languages like Java and Python with exceptions. Not checking for exceptions is a choice because everyone knows you need to check in your top-level functions. Forgetting to catch is a problem that only hits newbies.

    • @OmnipotentEntity@beehaw.org
      link
      fedilink
      42 months ago

      A problem that only affects newbies huh?

      Let’s say that you are writing code intended to be deployed headless in the field, and it should not be allowed to exit in an uncontrolled fashion because there are communications that need to happen with hardware to safely shut them down. You’re making a autonomous robot or something.

      Using python for this task isn’t too out of left field, because one of the major languages of ROS is python, and it’s the most common one.

      Which of the following python standard library functions can throw, and what do they throw?

      bytes, hasattr, len, super, zip