3 ms·
I’ve started using Python more for fun lately (coming from C and C#). I wish more languages used white space as things are so much cleaner - the odd messed up r
by osigurdson 4y ago
I’ve started using Python more for fun lately (coming from C and C#). I wish more languages used white space as things are so much cleaner - the odd messed up return statement / parallax error isn’t worth all of the curly brace noise imo.
- wvenable 4y agoI don't like it because at the top of blocks it looks fine but at the bottom I don't know what's going on: something another How nested are these things? I never know.
- c-fe 4y agoWith indentantion lines its clearer. And without indentantion lines, something}}}}} another isnt much clearer anyway imo.
- wvenable 4y agoRight but then you can auto-format it to have indentation.
- dragonwriter 4y agoIf your blocks are big enough that this isn’t obvious, that itself is a code smell. (Brackets also have the same problem.)
- wvenable 4y agoIf you have a loop inside another loop and say and if statement, it can be hard to tell where the end is: I'm in the IF What am I in? vs: I'm in the if } } } What am I in? I'm sure it's just personal preference and I don't like it. I don't think significant whitespace is sort of a universal good that maybe it seemed like when it was proposed. It now seems more problematic to me.
- dragonwriter 4y ago> If you have a loop inside another loop and say and if statement, it can be hard to tell where the end is: In either case, the aligned visible lines above (presuming reasonable block size) will be what clarifies that, assuming correct indentation (which is necessarily the case with syntactic indentation) and the brackets just add (in the example) three additional lines of separation making that harder.
- mixmastamyk 4y agoTurn on "indentation guides" in your editor. A dotted line will extend vertically across the block.
- osigurdson 4y agoI think it can become non-obvious in 10-15 lines. It is a trade-off, not a universal advantage. I suppose an IDE could cleverly draw little lines exactly when needed. One of the nice things about Python however is no IDE is required. This is one misgiving I have about C#, it is great but an IDE is nearly required.
- osigurdson 4y agoThis is what I mean by parallax error. It is a trade off for sure but imo a worthwhile one.
- TillE 4y agoI like any language which has opinionated style rules. I don't especially care what code looks like, as long as it's legible and consistent. C# actually has great comprehensive defaults, they're just not enforced as strictly as they could be.