3 ms·
Saying YAML is too pythonic when really you're talking about a file format used by other languages too is a bit cheesy but I get the criticism. Semantic white
by Lio 6y ago
Saying YAML is too pythonic when really you're talking about a file format used by other languages too is a bit cheesy but I get the criticism.
Semantic white space (originally called "The Offside Rule") predates Python.
I believe it was originally invented by Peter J. Landin[1], and yes the name is a joke about football.
The main problem for me is that it makes copy and paste more difficult. You can't just let the editor reformat for you and you have to be more careful with what you comment out.
Python devs seem to live with that OK though (I'm told) so maybe it's not such a big deal.
1. https://en.wikipedia.org/wiki/Off-side_rule https://en.wikipedia.org/wiki/Off-side_rule
- SiempreViernes 6y ago> The main problem for me is that it makes copy and paste more difficult. Heh, that makes for a good snark for dismissing the white space complaint, it's all from copy-paste programmers! (Or is more properly black space for all you darkmode lovers) > [...] you have to be more careful with what you comment out. Not sure if I get what you mean? I think python lacking proper multi-line comments (making things you want to ignore a multi-line string isn't as neat) is an irritant, but I don't get how semantic white space impacts the complexity of commenting?
- collyw 6y agoI didn't like Pythons whitespace when I first started using it after years of Perl and Java. Then after maybe 6 months I went back to writing some Perl code. I moved some blocks of code around, then got the dreaded missing brace problem where they didn't match up and I couldn't which brace wasn't matching up. I realized that I never encountered that problem in Python. That was enough to convince me of the benefits.
- zaphar 6y agoPython has the advantage that it is easier to control the level of indentation by breaking things out into functions without compromising the readability of the code. YAML sort of allows you to do the same using anchors but I find it doesn't help readability as much and sometimes hinders it. I think this might be because in yaml you are describing a data structure and it's far easier to understand that data structure if you can see the whole thing at once. In python you are describing code and for some reason in my head functions as an abstraction in code make it more not less readable.