News for hackers. Stuff that matters.
Re:Much Ado About None: Sentinel Values in Python by IshKebab on Sunday November 01, 2026 @03:54AM (#50323759)
Very many people have learnt that exceptions are bad and should be avoided, because they are bad and should be avoided. Some of those people work at Google.
Re:Much Ado About None: Sentinel Values in Python by flowilhelm on Sunday November 01, 2026 @04:38PM (#50330167)
Author here. Especially in Python, I think exceptions are not evil in any way but when it comes to typing they are a pain. Once gave a somewhat provocative talk about this that exceptions are gotos in a way :-) https://florianwilhelm.info/2025/04/evolution_of_goto/
Re:Much Ado About None: Sentinel Values in Python by IshKebab on Sunday November 01, 2026 @06:00PM (#50330797)
I wouldn't go as far as evil but they are bad for code quality because they obscure the behaviour of functions. You never know what exceptions can be thrown. Can a function even fail? Impossible to tell. (Don't say "documentation" lol)

The standard answer is checked exceptions, which I'm on the fence about, but they don't seem to be very popular in any case. Python doesn't have them. C++ removed support for them which shows you how unpopular they were. Java has them and IIRC they were kind of ok to use in Android. Kotlin doesn't have them though so I guess the Java people didn't really like them either.