Please note that my psuedo code in haskell was not function calls. It's a function definition using pattern matching in the function signature.
Think of Maybe as an enum with two values. A Just(a) and a Nothing.
The below definition basically says if the enum enters a function as a Just(int a) return int a. (Just(str) is a type error handled by the signature). If the enum enters the function as a Nothing return -1.
handleMaybeNum :: Maybe int -> int
handleMaybeNum Just a = a
handleMaybeNUm Nothing = -1
It is a simple mechanism that actually proves your programs to be correct. Type checking proves your program to be type safe. Exclusive use of pattern matching in haskell proves that your program logic handled every possible permutation of that type entering a function.
It is a powerful mechanism that is far greater than unit testing. Unit testing just says your is program correct for a specific test case. Haskell pattern matching and type checking provides a proof across every parameter permutation.
I realize python is an interpreted language. So an error can only be thrown at runtime. What I expect for an exhaustive match check in python is this:
Just(a), lambda a: a)
Just(a), lambda a: a
Apparently from the examples in the docs it clearly does not do this. You can literally match across types and it is unreasonable for the match operator to throw an error if you didn't cover every possible type that exists.
I didn't say it was the same. I said that if he bothered to read the link he would have seen the answer to his question.
Look up type annotations for python 3 and the mypy external type checker.
Static type checking is now a very real thing with modern versions of python.
Additionally it is possible to code the match function to implement the functionality I am talking about during runtime instead of compile time. Definitely not irrelevant.
Maybe, but I'm not sure there's more value in that.