Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why are people writing Python like it's Go?

Letting the KeyError go is usually fine, but if you want to log it or can recover somehow then:

    try:
      API_KEY = os.environ["API_KEY"]
    except KeyError:
      logger.exception("...")
      ...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: