The whitespace thing is actually one of python's major flaws. That feature attaches syntactic meaning to non-printing characters. From a human standpoint, there're many examples of silence having some kind of meaning. From an engineering standpoint, that entire methodology is insane. Communication needs to be positive and deliberate.Remember that Apple SSL bug "goto fail"? That was a whitespace bug, because even if the C feature predated python, everyone's eyes had been trained to slide right off that particularly crass shortcut as python was widespread by that point.
scoofy|2 months ago
I don't know what you mean by this.
>The whitespace thing is actually one of python's major flaws. That feature attaches syntactic meaning to non-printing characters. From a human standpoint, there're many examples of silence having some kind of meaning. From an engineering standpoint, that entire methodology is insane.
It's not non-printed characters, it's alignment. The period is a parallel for the semicolon in programming, to signal the end of a unit, but the whitespace in python is a parallel to the bullet point, or poetic stanza. Those both parallel to python in the form of atomic statements.
Most people's concern is the hanging indentation. Here, I would argue that we can effectively prove that hanging indentation is vastly more parallel to natural language than braces. Simply search for "handwritten recipes" and you will see that in a natural language assembly exercises -- effectively a real world parallel to programming -- human beings naturally default to hanging indentation when grouping sub-categories of items together.
https://duckduckgo.com/?q=handwritten+recipes&iar=images
Does this parallel to the jargony math you'll find in math books? No. But it trivially flows from human beings in the real world, and there is nothing formally incorrect in the syntax. Thus, we would likely find that layperson would intuitively understand the hanging indentation, where as braces as syntax is jargony, and must be learned.
LexiMax|2 months ago
I see where you're coming from. However, I would counter that in the use cases you've shown, as well as all of the use cases I've seen in the real world, there are important differences between them and Python.
1. Hanging indentation is most often used in things that are small in scope, where you can easily see both the start and the end of the list. Python blocks can grow without bound.
2. Hanging indentation in real life doesn't require perfect alignment. Python does.
prewett|2 months ago
Python executes like it reads, which seems like a positive feature to me. Makes errors like C's two-line if block impossible.
ethbr1|2 months ago
Spaces vs tabs, sure, that's an argument.
But it doesn't seem reasonable to argue that {something that is visible in a text editor} is different than any other kind of character.
It's not like Python was using the bell ASCII or somesuch.