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

why print then exit(1) instead of raising an exception?


Oh, I know this one:

  $ python3 -c "print('clear messaging'); exit(1)"
  clear messaging

  $ python3 -c "raise ValueError('text that matters')"
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ValueError: text that matters
and that story gets _a lot_ worse when some programs raise from within a "helper" module and you end up with 8 lines of Python junk to the one line of actual signal




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: