Hacker News new | ask | show | jobs
by tuxxy 2210 days ago
The project cites this blog post[0] on the "anti-pattern" that is Python exceptions, and I honestly couldn't be turned off on this project anymore after reading it if this is the inspiration behind it.

The examples in the README and this blog post just give me huge "nope" vibes. Obviously Python could learn a lot more from functional programming, but this is the wrong way to go about a lot of it.

0. https://sobolevn.me/2019/02/python-exceptions-considered-an-...

1 comments

It would be helpful if you could provide specific things in the blog post that you don't agree with. I skimmed through it and it seemed reasonable.
The example cited where they don't know what to return in their `divide` function if a division by zero occurs is nonsense.

The answer is simple: let the `DivsionByZero` exception raise! You don't have to return anything!

Better yet, you should have input cleansing/data validation before it gets to that point. The alternative presented in the blog post is absurd over-engineering.