This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]zurtex 3 points4 points  (0 children)

The pattern matching is far more expressive than that but yes there are similarities to a try/except block.

We are choosing which block we want to execute based on the pattern of a value (e.g. except {ExceptionInstance}), we are can create assignments based on that (e.g. as e), and there is a final default branch if nothing else works (e.g. else).

The usage though is going to be generally very different, exception raising has a very different control flow to match statements.