5 ms·
If you've spent any time with Python, it should be immediately clear that: if a > b a = a + 5 b = b / 2 is quite different from: if a > b
by nailer 17y ago
If you've spent any time with Python, it should be immediately clear that:
if a > b
a = a + 5
b = b / 2
is quite different from:
if a > b
a = a + 5
b = b / 2
Without needing a second markup for the compiler to emphasize the point.
- jacquesm 17y agoOf course it is clear that they are different, that was not the point of the argument... The point is that you can't know which one was the one that was meant to be written there in the first place, and all that changed is some literally invisible characters are gone. It's like with comments and code, if a comment says 'add two volumes' and I see that the code does not do that then I have a hint that something is not correct. It could be the comment or it could be the code, but there is something smelly there. Redundancy = good.
- nailer 17y ago'all that changed is some literally invisible characters are gone.' Er, no. That's not the extent of the changes at all: the very visible code has shifted to the left. I refuse to believe you cannot see that with your own eyes. 'The point is that you can't know which one was the one that was meant to be written there in the first place' In any language at all, the lack of indentation makes it quite clear the intention is different.
- pohl 17y agoYou've lost sight of jacquesm's premise, which is when 1) the intention is not accurately reflected by the indentation, and 2) does not break the syntax of the language. You asked what benefit might come from the redundancy of a curly brace, and this was a scenario in response.
- nailer 17y agoWhen the intention is not reflected by the indentation, you need to fix that, in every programming language. Python also has the handy benefit of telling you this immediately. jacquesm's statement about the visible difference is obviously false. However I don't think it's doing anyone any good to keep contributing on this topic. All I was doing was making a suggestion to improve something. The troll who posted 'no' with no arguments has a bunch of supporters, I'm being moderated down to nothing. You're not responding to my points, and you seem to think I'm not listening to you, though I'm trying to understand what you're saying. I give up, this isn't worth it.
- pohl 17y agoI'm only guessing, but the downmods may actually be because of disingenuous rhetoric. Example: "you need to fix that, in every programming language." This problem only exists if indentation is significant in the language as a way of demarcating blocks. This is exactly the reason for the suggested syntactic redundancy. A reasonable person can accept the tradeoff, but it's not reasonable to insist that the tradeoff isn't there at all. Edit: the proposed scenario is readable code. It is, in fact, disingenuous to ignore that. It isn't candid to claim apathy, either.
- nailer 17y agoNeeding to have readable code is a problem is every language. If you find that disingenuous, fine, I don't care anymore. Edit: you consider badly indented code readable? You must be great fun to work with. :^)
- pohl 17y agoIn my defense, Python would agree with me that it is readable: it would happily execute the line in the wrong block scope because of a single, invisible character was present or missing. I bet you meant "semantically correct" instead. Yes, every program's semantics need to be correct in order for the program to be correct. That's a tautology, and it's a deflection from the subject of the tradeoff analysis that you requested upthread. You're probably a bundle of joy to work with, too. :^)
- deleted 17y ago[deleted]