Hacker News new | ask | show | jobs
by disgruntledphd2 19 days ago
> when actually the "better" thing _could_ be to have a check once somewhere higher up the stack and dealing the None case there.

This is what I tend to prefer. Not always possible, but worth striving for.

> One thing I try to ask myself is "what would this look like without `| None`", and take it from there. Also, it isn't `| None` as such, it can be any union type: code can end up with blurry responsibility.

Yeah, unions can be problematic, but at least they're more legible than None as this can basically break everything.