News for hackers. Stuff that matters.
Re:Shell Style Guide by chronial on Tuesday May 15, 2018 @11:24AM (#17074616)
> You have to do everything manually

You are aware that error handling is done via exceptions python?

Re:Shell Style Guide by pas on Tuesday May 15, 2018 @11:36AM (#17074734)
You are aware that there's no compiler, and that you have to write the try-except-finally?

I'm talking about how weak guarantees Python gives compared to Bash about the correctness of the program. It's easy to get None-s, it's too easy to forget to handle file not found or lack of permission.

Re:Shell Style Guide by xapata on Tuesday May 15, 2018 @12:00PM (#17074930)
Maybe you should start raising exceptions instead of returning None.

I've almost never wanted to have my program do anything but crash upon file not found or permission error.

Re:Shell Style Guide by kemitche on Tuesday May 15, 2018 @12:22PM (#17075123)
For most scripts, handling file not found isn't gonna happen anyway. Often the result is just printing to standard out "hey I couldn't find file X" then bailing. An uncaught exception works well enough for this in many cases, such as build scripts.

Same goes for permissions issues and a whole slew of similar scenarios. For many use cases, the lack of forced error checking is a feature.

Concrete example: build scripts. As long as the cause of the build failure is clear from the uncaught exception, there's no reason to handle it. I don't need a friendly UI to avoid scaring off non technical users, I just need something that handles the happy path well and crashes with a meaningful stack trace when something unexpected happens.