Teacher:
Let's look at this code:
`comment: str = None`
Is the type correct?
mypy:
Yes, everything is just fine!

· · Web · 2 · 0 · 2

@alexcleac
Shouldn't that require Optional[str], or throw an error?

@gappleto97 mypy should throw an error probably. And yes, that should be marked as optional :)

@grainloom Hard to tell. Much of nowadays programmers became such because it is pretty to write the code nowadays. And thus is thanks to null/nil/undefined/None.

In fact, when you start writing some language that have a sane way to handle optionals (like etc), it becomes harder to write good and efficient code, because it requires a bit more thinking from you. Code is safer, but you have to use your head. And mass doesn't want this, they just need to make another unicorn startup

@alexcleac "good and efficient" is pretty vague tbh, if the code doesn't produce the correct result, it doesn't matter how fast it is.

@grainloom Businesses often say that nice result today is better than great one tomorrow :D However I agree with you on this - small bug can cost a lot more to business that an hour of qualified professional work

@alexcleac I can’t reproduce with that line by itself. Was it part of a larger block of code?

@cagatayy That was some time ago. Maybe this one is already fixed :)

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!