3 ms·
> Also, there is little fundamentally different between throwing an exception and returning an error result. Thank you. I was about to reply the same. The most
by 7bit 2y ago
> Also, there is little fundamentally different between throwing an exception and returning an error result.
Thank you. I was about to reply the same. The most notable difference is that from a usage-perspective is that exceptions bubble up automatically, whereas errors must be returned manually.
I usually don't follow the error vs. exception debate because both have their difficulties and both let's you write code that behaves different than you anticipate.
I prefer exceptions, especially how Python handles them (most of them at least). The only thing I really would love to see is something like Rusts Option() type in Python so assigning values to variables inside a try: would not require me to have variables with typ int|None. That's really yuck.
- mewpmewp2 2y agoWhy is that more yuck than Option?