Re:Frankenstein's `__init__`
by greatgib on Saturday April 19, 2025 @12:03PM
(#43737293)
Nothing prevents you to have a valid "not_yet_started" state.
[ Parent
| on HN ]
No, but it does complicate things substantially. I don't understand why you would have a useless half-constructed state, especially in python where init isn't all that magical.
The benefits of making illegal states unrepresentable are just not widely understood outside of pure FP circles. I think it's hard for stuff like this to catch on in python in particular because everything is so accessible and mutable, it would be hard to talk about anything that provides the level of confidence that eg. ADTs in Haskell provide. And it's hard to understand why you would want to try to do something like that in a context like python unless you already have experience with it in a statically typed context.
And what would you do with this object after construction? Call start() on it immediately?
Kind of yes or no, depend on your usage. But clearly would have worked well for the case of the automatic test if the start was the context