Conversation

Replying to
You can do next(iter, None) to be fair, but even exceptions for flow control in Python are really annoying. Plus there's no way to distinguish "value is None" and "did not return a value" and "exception occured".
2
Replying to and
It just gets even worse for C++ because it's optimized for zero-cost exception handling and has to unwind the stack for any operation done in a try/except block (an implementation detail but in GCC/Clang/MSVC). For speed on the "correct" path, C++ incurs major performance hits.
1
Show replies