3 ms·
> You can just as easily make a mistake in bracketing I actually strongly disagree with this. There's a reason basically every style guide under the sun defau
by horsawlarway 5y ago
> You can just as easily make a mistake in bracketing
I actually strongly disagree with this. There's a reason basically every style guide under the sun defaults to requiring brackets for things like single-line conditionals (where they're optional in a lot of languages): It removes this class of error entirely.
There are lots of other ways to fuck things up with brackets, so no arguments there.
> If you're blindly running software that has never been looked at, tested, and even run once to verify it works, the main problem is elsewhere.
I don't think this is really relevant. In this context - the goal of the student isn't to produce good python code, it's to complete the lab they're working on with their partners. The single biggest case I see where this happens is as follows:
1 - Student A writes some code
2 - Student B writes some code
3 - Student A wants to use what student B wrote
4 - Student A copies the code from student B into their file, but the indentation is wrong.
5 - Student A then starts removing indentation (line by line - which is the real mistake, really) and goes one line too far, or one line too short.
6 - Student A and B test one of the cases for the integrated code (either the success or the failure) and it works fine (in my example, imagine they test the error case and see it does what they expect)
7 - Then later they realize the other case is breaking, but they don't know why: usually because it's been half an hour since they pasted that code into their editor, and checking indentation doesn't immediately come to mind.
8 - I get called over to help
- mixmastamyk 5y agoThere is easy to learn and easy to use, they are not always equal. They shouldn't be copy and pasting between each other if they don't understand how indentation works. Basics first. A good editor can help. Geany is good for beginners and can show whitespace. I also recommend the tool pyflakes to everyone, beginner and expert alike.