How coding in Python is bad for you

Ben Bacarisse ben.usenet at
Tue Jan 24 14:50:20 EST 2017

Chris Angelico <rosuav at> writes:

> On Wed, Jan 25, 2017 at 3:21 AM, Ben Bacarisse <ben.usenet at> wrote:
>> Chris Angelico <rosuav at> writes:
>>> On Wed, Jan 25, 2017 at 2:51 AM, Ben Bacarisse <ben.usenet at> wrote:
>>>> Chris Angelico <rosuav at> writes:
>>>> <snip>
>>>>> ... I teach JavaScript as well as Python, and I've seen some
>>>>> pretty horrendous indentation flaws (examples available if people ask
>>>>> privately, but I will anonymize them because I'm not here to shame
>>>>> students) - but there have been nearly as many cases where the
>>>>> indentation's fine and the bracket nesting isn't.
>>>> Can I ask what editor(s) your students have available?  I ask because
>>>> I've not given a moment's thought to indentation or what bracket matches
>>>> what for decades due to having a helpful editor.
>>> Quite a few, depending on which platform they're using. I'd say
>>> Sublime is the most common choice.
>> So what's going in your opinion?  The errors are in the group who don't
>> use the right tools or what?
> In my opinion, what's going on is that exploring code is a messy
> process, and that the more little finicky things you have to get
> right, the more likely you'll get something wrong. Which one you get
> wrong is pretty much arbitrary.

Do you think the tools (the editor in particular) could be more helpful?
As I said elsewhere I've forgotten how these sorts of errors happen so I
have very little insight into how to prevent them.  With token-marked
blocks I feel (though I don't know) that matching and auto-indenting
help me to know I've written what I intended to write.  I was just
surprised that these errors happened enough for you to comment on them.

> Getting indentation wrong in JS won't affect the interpreter, but it
> majorly affects the human. Which one would you rather confuse?

I'm guessing that's a rhetorical question! (It obviously depends on the
situation.)  I suspect that part of the reason these errors occur is
precisely because they don't matter to the interpreter and students are
doing a lot of self-easement based on "does it work?" tests.  This is
why Python is a win in such situations -- you can't write confusingly
indented code, only wrong code.


More information about the Python-list mailing list