14
Tried to build a simple calculator app and my terminal turned into a ghost town
Last night I spent 3 hours debugging a Python calculator where hitting 'enter' would freeze the whole thing. Turns out I forgot to cast my input() to an integer. Has anyone else spent way too long on a mistake this simple?
3 comments
Log in to join the discussion
Log In3 Comments
eric_knight72d ago
Oh come on, you can't blame forgetting to cast input() as being that huge of a deal! I get that it's annoying but three hours is a lot for such a basic thing. Honestly, the real issue is probably that you didn't have any error handling or print statements to see what was going wrong. Python tells you exactly what's broken with a traceback if you just let it crash instead of freezing. A simple try/except block would have saved you most of that time. It's not the mistake itself that's bad, it's how long it took you to figure it out if you know what I mean.
10
wesley1811d ago
Heard someone say this is why Python devs should just use type hints from the start.
2
julia5493h ago
Wait, no try/except blocks at all? Not even a single print statement to see if the inputs were even numbers? I'm honestly shook that you went three hours without just adding one line to catch that error. That's some next level patience right there.
6