News for hackers. Stuff that matters.
Re:If AI writes your code, why use Python? by zahlman on Tuesday May 12, 2026 @04:49AM (#48105801)
> I find brackets help me understand structure from a distance much better than whitespace.

I can't imagine how. Whitespace physically lays out the block structure on the screen; braces expect you to count and balance matching symbols, and possibly scan for them within other line noise.

Re:If AI writes your code, why use Python? by KptMarchewa on Tuesday May 12, 2026 @07:21AM (#48106679)
This is a 00s POV. If you spend any time on syntax formatting in 2026, you're wasting it. It's a solved problem.

Any reasonable language with braces has standard formatter that will just put each brace level on a different whitespace level.

Re:If AI writes your code, why use Python? by zahlman on Tuesday May 12, 2026 @07:17PM (#48115857)
Yes, and so will any reasonable text editor automatically indent to the most likely position, and remove an entire indentation level with backspace, and substitute spaces for tabs per community standards, and keep everything lined up neatly.

But GGP was making a claim about the braces themselves solving the problem, and they clearly do not. The indentation automatically inserted by your tooling solves the problem. And it's at least as easy to communicate the intended block structure with colons and backspaces as with open braces and close braces, plus it doesn't waste lines (or invite bikeshedding) for the closing braces.

Re:If AI writes your code, why use Python? by polytely on Tuesday May 12, 2026 @05:13AM (#48105936)
Working in C# i feel basically still read code structure by the visual block structure / indentation. I dont think I've ever counted braces in my professional life. The IDE makes sure it is formatted correctly and ambiguity is basically impossible.
Re:If AI writes your code, why use Python? by zahlman on Tuesday May 12, 2026 @07:18PM (#48115865)
Exactly. So if the indentation is the actually salient thing, why not use it directly?

I mean: you don't count the braces because your tooling counts them and makes the indentation match what Python would use anyway. If you had just created that indentation in the first place (which with a proper editor is at least as easy as typing the braces; you essentially type : instead of {, and backspace instead of } ) then you'd be in the same place, except without the extra punctuation noise (well, with half of it, because GvR thought the colons were a useful signal even if redundant).

Re:If AI writes your code, why use Python? by pmontra on Tuesday May 12, 2026 @06:22AM (#48106282)
Nevertheless it happens that while moving code around one wonders what indentation level that code should go. Undo, undo or git show the original code, look at it, retry more carefully.

Brackets would allow the editor to autoindent the pasted code.

No choice is perfect.

Re:If AI writes your code, why use Python? by RHSeeger on Tuesday May 12, 2026 @08:26AM (#48107263)
Whitespace and braces work together to make the code more readable; both by the computer and the human. And they make it less likely to have errors, because the braces convey intent (much like parens in math when they're not "needed")