4 ms·
It's interesting that people keep claiming that indentation-based blocks makes Python easier to learn and read. I've been teaching programming to students in ba
by ngrilly 4y ago
It's interesting that people keep claiming that indentation-based blocks makes Python easier to learn and read. I've been teaching programming to students in banking, finance and insurance for a few years, using Python, and my experience with them is the opposite. They have been struggling with that a lot. They didn't pay too much attention to white spaces and tabs, probably because they are "invisible", and couldn't see why a statement was not executed at the end of the block, because it was not indented correctly. For me, it was obvious, because as a professional programmer, I've been trained to pay attention to details. But for most of them, it made no sense. Explicit block markers are much easier to teach.
- thephyber 4y ago> Explicit block markers are much easier to teach. The point of communication is to express something in a way that the listener understands it. Simply expressing something that is comfortable or normal to the speaker is simply not useful for either party of the goal is communication.
- ngrilly 4y agoYou're right. What matters is that explicit block markers are easier to learn (from the student's perspective). Being easier to teach (from the teacher's perspective) doesn't matter as much.
- SiempreViernes 4y agoSure, but without the white space defined blocks it is entirely on you to teach them about the importance of formatting their code to ensure readability.
- ngrilly 4y agoThat's right. That's the other side coin. But I'm not convinced it matters that much nowadays when most languages provide code formatters.
- thephyber 4y agoMy point was to express that your students need to learn to communicate with the programming language in a way that the language understands, not in a way that is comfortable for them as the “speaker”. You as the teacher should be setting that expectation.
- Izkata 4y agoOn the other hand, back in college I was a TA for an intro to programming course that used Java. This: > They didn't pay too much attention to white spaces and tabs, probably because they are "invisible" can get so much worse than people imagine, when the language doesn't enforce it. It was that experience that made me lean towards python being a good introductory language, to help people get used to correctly indenting code in general.
- ngrilly 4y agoAgreed. Zig for example is considering triggering an error for incorrectly indented code/misleading indentation: https://github.com/ziglang/zig/issues/35 https://github.com/ziglang/zig/issues/35
- marcosdumay 4y agoIMO, the thing about beginners and relevant white space is that it forces them to learn how to indent their code, not that it makes it any easier to learn the language.
- dpedu 4y agoCode is still completely unreadable with explicit block markers, if it is without appropriate indentation and newlines. That's like trying to read minified javascript. And python forces you to have these, to some extent.