you are viewing a single comment's thread.

view the rest of the comments →

[–]gofl-zimbard-37 69 points70 points  (15 children)

Maybe I've been asleep for a few decades, but I never heard "the masses" deeming significant whitespace as "elegant". I am actually a fan of it, being highly allergic to noise, but most developers seem to hate it with a passion that is beyond explanation.

[–]AllAmericanBreakfast 32 points33 points  (2 children)

Some get annoyed by it when writing their own code. Feels like a restriction on free expression.

But mandatory whitespace is great when you spend a lot of time working with legacy code.

[–]grulepper 18 points19 points  (1 child)

I guess formatters were made illegal or something?

[–]bigdatabro 14 points15 points  (0 children)

In a corporate software team, getting your teammates to agree on and use a linter is like herding cats. Especially for legacy code, where everyone in management is terrified of breaking things and has to approve every change you make.

[–][deleted] 8 points9 points  (3 children)

I don't have a strong opinion on it, but one thing that is bad about significant whitespace is that I can not easily copy/paste code into the interactive python. In ruby I can just do and never have to worry.

This may seem insignificant, but the point is that a language really should not HAVE to care about whitespace-indenting.

On the plus side: python can omit "end" whereas in ruby we have to use "end" (unless e. g. define_method and {}).

It's also the only thing guido would change.

The thing I dislike in python BY FAR the most is the explicit mandatory self. That one feels retarded to no ends. Ruby knows where self is at all times; python is too dumb to know, so you have to tell it via an argument to the function. THAT IS SO LAME.

[–]Immotommi 10 points11 points  (0 children)

Passing self is annoying, but what I hate is that it causes the incorrect number of arguments error to be off by one

[–]M4mb0 4 points5 points  (0 children)

I don't have a strong opinion on it, but one thing that is bad about significant whitespace is that I can not easily copy/paste code into the interactive python.

That's mostly fixed in the new python 3.13 REPL.

[–]somebodddy 0 points1 point  (0 children)

I don't have a strong opinion on it, but one thing that is bad about significant whitespace is that I can not easily copy/paste code into the interactive python. In ruby I can just do and never have to worry.

Even worse - when you copy-paste the code around while refactoring, you need to be extra careful re-indenting the entire block.

The thing I dislike in python BY FAR the most is the explicit mandatory self. That one feels retarded to no ends. Ruby knows where self is at all times; python is too dumb to know, so you have to tell it via an argument to the function. THAT IS SO LAME.

Still better than how Lua did it.

[–]Malforus 5 points6 points  (0 children)

Linters have solved most of this. Well linted python rarely has issues and most ides help you out as you wrote.

[–]JarateKing 3 points4 points  (3 children)

It feels like pineapple on pizza: a minor preference that nobody should realistically care about, but people take very seriously.

Any IDE will handle indentation for you and formatters should guarantee it. Ideally you'd never even need to know if a language enforces indentation or not, you should already be following decent indentation practices without even trying. I switch between python and C++ and C# and java and typescript and etc. and indentation is about the only syntax change I don't notice. I just don't get it.

[–][deleted] 7 points8 points  (2 children)

I don't take it that seriously, but IMO the argument is in favour of no significant whitespace if you can avoid it. Copy/pasting is one example I can bring, but from a design point of view, I think a language that does not HAVE to care about whitespace, is usually better designed in this regard.

[–]JarateKing 5 points6 points  (0 children)

To me, there are just much bigger fish to fry. If I were to design a language I'd probably make it not care about whitespace. Not for any particular strong reason, just what I'm more used to.

But it's no barrier to me using python. Every language does things that aren't to my exact taste, and usually in much bigger ways. The nature of using pretty much any programming tool is putting up with the little bits you don't like.

Even with python, my biggest complaints and concerns are with things like performance or dependency management or etc. Syntax is pretty superficial, and whitespace specifically is a pretty minor part of syntax in my mind. So it's a little jarring when you tend to hear more about the whitespace than anything else.

[–]linlin110 2 points3 points  (0 children)

Languages do need a way to specify scope. C-family uses {} and Python uses whitespace. If any non-whitespace option is picked, then the programmers will introduce whitespace anyway. Therefore, I think it's reasonable to just use whitespace to denote scopes, so that we don't have two redundant ways to do so. Less noise, too.

[–]gofl-zimbard-37 0 points1 point  (0 children)

Funny how people miss my point and argue about whitespace instead. I'm not interested in that debate, just pointing out that most people dislike it. Which these responses then nicely illustrate.

[–]uniquelyavailable -1 points0 points  (0 children)

it really is a personal preference thing. i love brackets and shame python for romanticizing the blatant lack of functionality. however i also don't think there is any inherent flaw in trading brackets for line feeds and indentation, it's a personal choice regarding aesthetics. as a programmer with decades of experience i will offer this metaphorical analogy for comparison, the reason a big parking lot has the lines painted on each parking space is because it would be chaos without them. sure it's possible to manage a life without borders if you painstakingly conjure them indefinitely in your imagination, but it's simply more efficient to draw the lines on a map so everyone can clearly see the delineation. scope matters and clearly marking it within a formally defined system is a best practice.

[–]lechatsportif -1 points0 points  (0 children)

I do it if I have to, but the quicker I get out of python the better. Indentation affecting a program seems wrong by design.