I am mostly confused by this. The author started out with a friend's question about an Either implementation and ended up with an enumeration and an option.
Enumerations are useful for a number of reasons in typed, compiled languages (I guess they provide readability in Python), but they are not the same as monads (of which Either is one type). I am not a Python developer, but as far as I can tell, this implementation gets you none of the real benefits that an a true Either implementation would get you in terms of functional goodness.
Am I missing something here? Is there some kind of Python magic that makes this better than just propagating the exception?
I thought the same thing. There are so many other options in the Python toolbox, Enum is far from the first I would reach for. Not sure what the benefit is.
Enumerations are useful for a number of reasons in typed, compiled languages (I guess they provide readability in Python), but they are not the same as monads (of which Either is one type). I am not a Python developer, but as far as I can tell, this implementation gets you none of the real benefits that an a true Either implementation would get you in terms of functional goodness.
Am I missing something here? Is there some kind of Python magic that makes this better than just propagating the exception?