3 ms·
You can't really use Maybe like in Haskell without a static type system. After all, in Python, there is no actual Null-pointer exceptions; instead, you have Ty
by tikhonj 14y ago
You can't really use Maybe like in Haskell without a static type system.
After all, in Python, there is no actual Null-pointer exceptions; instead, you have TypeErrors that just happen to trigger on None. Even if you had some sort of option type, you would still get runtime errors because there is not enough information to deal with them at compile time.
Now, you could add some sort of abstractions to make checking for None in your code easier. But when your "benevolent" dictator hates folds, you're not getting any advanced features like monads any time soon!
- mamcx 14y agoYep, the sad thing is that you can't get all in a single package. The type system in Haskell look very good. But the cobra language have a implementation very close and in line with the spirit of python...