News for hackers. Stuff that matters.
Re:I'm Switching to Python and Actually Liking It by globular-toast on Thursday July 17, 2025 @02:38AM (#44590386)
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("...")
      ...

There are no comments on this comment yet.