Hacker News new | ask | show | jobs
by squirtlebonflow 1068 days ago
I don't think you should write code where it makes a difference if the None came from a T that happened to be None or from a None.
1 comments

Why would you ever use T | None otherwise? As far as I can see the only reason to ever use T | None is because you want to write code that does one thing if it's a None and another thing if it's a T. Having it do the other thing if that T happens to be None makes no more sense than having it do the other thing if that T happens to be 5; at best it might work by accident, more likely it will be a subtle bug.