Hacker News new | ask | show | jobs
by PhantomGremlin 4505 days ago
People bitch about indentation in Python. But in this case it would have prevented the bug!

Of course Python doesn't even have a goto, so the code would have needed to be structured differently to start with.

If I were a betting man I'd wager that this bug wasn't really an accident. It would be really interesting to check commit logs to see the history.

2 comments

> People bitch about indentation in Python

Really? I did something in Python for the first time a while ago and the indentation as code block is something I find very elegant. I can't fathom why would people find something wrong with this.

it's relatively harder to refactor code - you can't just select between { and }. otherwise, no idea - python is my weapon of choice, so i may be biased.
Can't really write onliners. And use of otherwise great interactive shell is not as good (not that bracketed blocks would help).
Style guideline of using curly braces with ALL if statements, even one liners, would have gone a long way to prevent this.
Code reviews and comprehensive test suites for critical code would have prevented this and many other kinds of mistakes besides.