Earlier quoted context omitted.
When I hear someone complain about the whitespace thing, it sends a message to me that they do not format their code well and just go willy-nilly on their indentation. If you're properly indenting code, then it always works as intended . Proper indentation doesn't come from a desire to make the code work, it comes from a desire to make it readable. It just happens that readable means correct in Python's case. It lite…
I just translated all my build scripts written in Python to straight C due to indentation issues. Not because I don't format my code properly, but because any time I refactored my code, I ended up with dozens of subtle indentation related bugs that took hours to find and fix. If your language requires an IDE, then you have become Java.
Show HN: Python with do..end in place of strict indentation
31–40 of 71 posts
Re: Show HN: Python with do..end in place of strict indentation
#32Earlier quoted context omitted.
Not being able to nest multiline lambdas into function arguments where they are called makes you have to read a lot of code backwards.
I do wish it had lambdas. That's largely mitigated by the fact you can define functions pretty much anywhere. Instead of: def my_func(): another_func(lambda: ...) you can write def my_func(): def inner(): ... another_func(inner) Sure, it's creating a function, naming it, then immediately throwing it away, but gets the job done with minimal extra boilerplate.
Re: Show HN: Python with do..end in place of strict indentation
#33Anyone who can't see past Python's indentation-based syntax is a person who doesn't understand Python. (Both literally and figuratively!) When "significant whitespace" is at the top of someone's complaints about Python, I'm immediately done hearing about their superficial criticism of the language.
Literate programming tools that weave/tangle code and documentation don't play well with significant whitespace. Not a problem for me, but I think it's on a valid line of complaints.
>=
if 1 == 1:
print('1 == 1, shocking!')
>=
def foo():
>
It will generate properly indented code when tangled as in: def foo():
if 1 == 1
print('1 == 1, shocking!')
Note that it puts in precisely two extra spaces for each line in the tangled `body`, which is the amount used in the block named `function` where it references `body`. If you used 4 spaces of indentation, it would use 4 in the tangled output. I've also used noweb and don't recall this being an issue, however that was not with Python so it's possible I just didn't notice a problem with it.Re: Show HN: Python with do..end in place of strict indentation
#34Anyone who can't see past Python's indentation-based syntax is a person who doesn't understand Python. (Both literally and figuratively!) When "significant whitespace" is at the top of someone's complaints about Python, I'm immediately done hearing about their superficial criticism of the language.
Re: Show HN: Python with do..end in place of strict indentation
#35Anyone who can't see past Python's indentation-based syntax is a person who doesn't understand Python. (Both literally and figuratively!) When "significant whitespace" is at the top of someone's complaints about Python, I'm immediately done hearing about their superficial criticism of the language.
When I hear someone complain about the whitespace thing, it sends a message to me that they do not format their code well and just go willy-nilly on their indentation. If you're properly indenting code, then it always works as intended . Proper indentation doesn't come from a desire to make the code work, it comes from a desire to make it readable. It just happens that readable means correct in Python's case. It lite…
Once I'd become accustomed to languages where automatic formatting is feasible, having to do any of this sort of thing by hand started to feel like a real imposition. I didn't object to this aspect of Python when I first learned it, because it didn't feel much different from writing my C code, but now, after years of clang-format (and Visual Studio's auto format, and gofmt on the occasions I've been forced to use Google Go...) I just can't be bothered. How dare it make me press return. How dare it make me press tab. I have better things to do with my life than what I can only describe as this. fucking. shit.
Re: Show HN: Python with do..end in place of strict indentation
#36I used to code in Python for everything in the late aughts and loved meaningful whitespace. Whenever I used a language with braces like JavaScript, for instance, I felt like I was still indenting code meaningfully but now I had the extra hurdle of also caring about the braces. It felt unnecessary and stone-agey. But back then I was just using vim with a nicely configured .vimrc. Linters weren't really a thing, or at…
> I also have the benefit of the compiler screaming at me if I forget a brace, pointing to the exact error including telling me when indentation is suggesting a brace is missing!
What the compiler is telling you here is that the braces are superfluous, because the indentation is already describing the structure correctly. So why bother?
My take is that in the (amazing!) new world with near universal usage of standardized linters, this whole debate is stale, it just doesn't matter either way. Everything is indented properly, whether or not it is necessary for correctness. So whether there is a bit of additional bracing or not, who cares?
Re: Show HN: Python with do..end in place of strict indentation
#37Earlier quoted context omitted.
When I hear someone complain about the whitespace thing, it sends a message to me that they do not format their code well and just go willy-nilly on their indentation. If you're properly indenting code, then it always works as intended . Proper indentation doesn't come from a desire to make the code work, it comes from a desire to make it readable. It just happens that readable means correct in Python's case. It lite…
I just translated all my build scripts written in Python to straight C due to indentation issues. Not because I don't format my code properly, but because any time I refactored my code, I ended up with dozens of subtle indentation related bugs that took hours to find and fix. If your language requires an IDE, then you have become Java.
I’ll give you the benefit of the doubt, this sounds very curious.
Re: Show HN: Python with do..end in place of strict indentation
#38Anyone who can't see past Python's indentation-based syntax is a person who doesn't understand Python. (Both literally and figuratively!) When "significant whitespace" is at the top of someone's complaints about Python, I'm immediately done hearing about their superficial criticism of the language.
Re: Show HN: Python with do..end in place of strict indentation
#39Seeing code blocks as braced or meaningfully indented should be a switch in your IDE.
I consider this to be both totally sensible and completely impractical :)
Re: Show HN: Python with do..end in place of strict indentation
#40Anyone who can't see past Python's indentation-based syntax is a person who doesn't understand Python. (Both literally and figuratively!) When "significant whitespace" is at the top of someone's complaints about Python, I'm immediately done hearing about their superficial criticism of the language.
Which is a shame, cus otherwise Python is good imo.. I feel like its creator just had a weird whitespace fetish or something.