14 hours ago · Tech · 0 comments

I’m not up for a lot today. Let’s review those methods that can optionally return None and see what we can learn, maybe what we can do. Results: acceptable if not entirely satisfactory. A key moment in the debugging thrash of this week was a None being returned where a Room was expected, with concomitant exceptions being raised, because, well, None really doesn’t understand much about being a Room. Mind you, returning None was not the bug, but it was caused by the bug, which was so subtle that I have to write paragraphs to explain it and still haven’t seen a practice improvement that would have prevented it. Nonetheless, there are some other cases of returning None in the code, and whenever we do that, there’s the near certainty that we’ll raise an exception soon, as soon as someone (YT) forgets to check for the case. Even if the fool remembered to check, it’s still messy having to check all the time. Yesterday I listed these ideas around the topic of doing better with None: Use the…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.