3 ms·
I can see where he's coming from. It's the typical reaction of a beginner programmer. None/Null in many languages isn't type checked even if the language itsel
by deltaonefour 5y ago
I can see where he's coming from. It's the typical reaction of a beginner programmer.
None/Null in many languages isn't type checked even if the language itself has static type checking. It can be passed to other functions mysteriously and remain a hidden error. Javascript and C++ are guilty of this. He's complaining of a safety issue most likely.
However note the type signature I specified Optional[Int] encodes the None type into the static type checker. In modern programming this implies Null/None safety at the type level.
I'm not up to date with the current state of python type checkers so those type checkers may let some things pass depending on some options you set. See my reply to the other guy for a more detailed expose.
- globular-toast 5y ago> I can see where he's coming from. It's the typical reaction of a beginner programmer. This seems like the typical response of someone who posts bait ready to flex their "advanced programmer" knowledge. There's really no need to call out people's level of experience, ever. Personally I'm past the point where I think I've learnt everything so I just ask questions when I don't know.
- deltaonefour 5y agoI am not calling anyone out. Let me be absolutely clear with you, there is NOTHING and I mean absolutely nothing wrong with asking questions or being a beginner programmer. The problem with your earlier post was that you weren't asking a question. You were stating something as if it were a fact.
- globular-toast 5y agoI only stated that division by zero shouldn't return None, which you seem to agree with, no? The difference is how you ensuring that doesn't happen. You really only needed to say "this let's you do a static check to make sure you're not dividing by zero".
- deltaonefour 5y agoNo. I don't agree, I'm saying the None is better so long as you encode the concept of a None into the type. This is done by converting an Int into Optional[Int].