DIP 1002 (TryElseExpression) added to the queue

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 28 03:19:45 PDT 2016


On Tuesday, 27 September 2016 at 09:30:10 UTC, Dicebot wrote:
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1002.md
>
> PR: https://github.com/dlang/DIPs/pull/43
>
> Abstract:
>
> In Python, the try/catch/finally syntax is augmented with an 
> additional clause, termed else. It is a fantastically useful 
> addition to the conventional syntax. It works like this:

I support this addition because, while it's possible to mimic 
this behavior now, this makes code cleaner.

I will also post some rationale from the Python docs:

"The use of the else clause is better than adding additional code 
to the try clause because it avoids accidentally catching an 
exception that wasn’t raised by the code being protected by the 
try/except statement."

https://docs.python.org/3/tutorial/errors.html#handling-exceptions


More information about the Digitalmars-d mailing list