Why exceptions for error handling is so important
via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 13 05:29:15 PST 2015
On Monday, 12 January 2015 at 19:27:34 UTC, Russel Winder via
Digitalmars-d wrote:
>
> On Mon, 2015-01-12 at 09:54 -0800, H. S. Teoh via Digitalmars-d
> wrote:
>>
> […]
>> Yeah, exceptions are supposed to be ... well, *exceptions*,
>> rather than the norm. :-) If you're using exceptions to do
>> flow control, you're doing something wrong.
>>
> […]
>
> Unless you are writing Python code.
You are doing Python a disservice here. Their use of exceptions
for control flow statements is an implementation detail,
introduced because Python exceptions are fast. (In the C runtime
a Python exception is a global variable and functions that return
0;. ) The whole argument stands on its head.
The discussion of good Python coding style and Python's
usefulness might be found elsewhere.
More information about the Digitalmars-d
mailing list