News for hackers. Stuff that matters.
Re:Python exceptions considered an anti-pattern by detaro on Monday February 11, 2019 @07:47AM (#19134001)
The interesting bit starts at https://sobolevn.me/2019/02/python-exceptions-considered-an-..., where it introduces a library for wrapping errors in return types, even if it got little to do with the headline. IMHO the article would be stronger with a title about what it presents and without the first half.
Re:Python exceptions considered an anti-pattern by OJFord on Tuesday February 12, 2019 @02:25PM (#19146624)
Agreed, I read the first half thinking You know, I kind of agree, but it would 'trigger' most of my colleagues - then I started thinking Oh I wonder if you could build something into mypy like rust's Result<Ok, Err> (I realise that's not rust's invention, probably haskell's?, but it's rust that made me more familiar with the concept) - then I got there in the article, great!

"Typing failure modes, not just successful returns" or something would sound like a much more appealing article to a much wider audience.

Re:Python exceptions considered an anti-pattern by sobolevn on Monday February 11, 2019 @08:05AM (#19134115)
Thanks, my idea was to state the problem and propose a solution. Hope, that you will find `returns` helpful.
Re:Python exceptions considered an anti-pattern by detaro on Monday February 11, 2019 @08:18AM (#19134211)
One risk with the title is that it doesn't convey that it's actually proposing a solution instead of being one of many "$languagefeature is bad" articles. I personally also found the problem statement presentation not all that convincing and almost closed the tab before reaching the interesting section, which is why I made the comment above.
Re:Python exceptions considered an anti-pattern by _ZeD_ on Tuesday February 12, 2019 @02:13PM (#19146505)
I'm sorry, but from my perspective - a java developer that has moved to scala - this "let's drop checked exceptions for Either[Exception, T]" stuff... stinks.

And for one specific reasons: Exceptions are not important per se, but also for the stacktrace they take with them, and that is given to you when you need to handle it.

I lost too much time in this last month trying to decipher where the hell stuff happened looking at the stacktraces in the logs.

Coming back to the python approach: I like python :) and it's philosophy it's to have unchecked exception, with all what it concerns. The idea is that if you don't know an exception, you really don't know what to do. So let the code blows up - ideally in tests :) - and understand what realistically can happen and how to deal with it.

Re:Python exceptions considered an anti-pattern by muggermuch on Tuesday February 12, 2019 @01:08PM (#19145901)
Thanks for the solution! It's elegant and is a great fit for my current work which involves retrofitting my codebase with type annotations.