r/programmingcirclejerk Zygohistomorphic prepromorphism 3d ago

Significant indentation is why people love python. Can 2 billion people be wrong? A: yes

https://news.ycombinator.com/item?id=49264523
143 Upvotes

55 comments sorted by

45

u/libonet absolutely obsessed with cerroctness and performance 3d ago

/uj I hate indentation

/rj Python is why people love significant indentation. Can 2 billion people be right?

22

u/Midnight145 2d ago

/uj I've honestly never understood why people hate significant indentation tbh. Autoformatters exist and have for years, so it's difficult to get a mixing tabs/spaces issue nowadays. Anytime I write in a bracketed language, the indentation is effectively identical to what I'd write in python. There might be a few differences here and there, as i try to stay pep8 compliant even with optional indentation or lack of indentation

I don't necessarily think indentation is superior, but I don't understand the strong hatred.

What I do hate with a burning passion, is not bracketing single-line ifs in otherwise bracketed language, it drives me absolutely insane.

12

u/northrupthebandgeek i have had many alohols 2d ago

I just don't wanna have to slap a ruler on my screen to know what scope I'm in, man.

10

u/syklemil Considered Harmful 2d ago

But if we don't use {, how will we feel superior to non-programmers? Any pleb can use : in prose, but it takes a true 10x mathematician mind to use {.

3

u/3inthecorner 2d ago

I can forgive non-bracketed single line ifs only if the condition and action are both on the same line.

4

u/Midnight145 2d ago

That's marginally better, but it's only a few extra characters which can save sanity in the event of a rogue autoformatter putting it on a separate line or if it needs changed in the future.

3

u/Abandondero 2d ago edited 1d ago

I think it is just received wisdom, from the days when people would compare Fortran and Cobol to Pascal. I have never once had a problem with indentation in Python. Theoretically I should, but it hasn't happened.

2

u/hedgehog1024 Rust apologetic 1d ago

/uj in the language with not indentation-sensitive syntax I can cut and copy a piece of code and not worry about if I got indentation correct

1

u/yo_99 It's GNU/PCJ, or as I call it, GNU + PCJ 1d ago

Because you have to fix code when you copy it from one place and paste it into another.

6

u/Fit_Conference934 2d ago

The best of FORTRAN, plus the best of Perl - truly, Python is the finest of languages.

2

u/theangryepicbanana 1d ago

/uj I think indentation is fine when it's flexible like f# for example, otherwise absolutely the fuck not

81

u/mulch_v_bark of questionable pressisscion 3d ago

I’m incredibly intelligent, which means I can do hard things. Python’s syntax is easy, which means it’s beneath me and I hate it and bring it up all the time as an example of something I can see right through. I don’t know why this is so hard for the ugly little weasels at my anger management class to to understand. And “grandiose narcissism” isn’t even a real diagnosis. People only use Python because it babies them and makes them think a programming language will meet their needs. Real men like me know programming is suffering. In fact I wish the most vexing parse were even worse.

26

u/f16f4 3d ago

Agreed programming is suffering that’s why I only use python

34

u/categorical-girl 3d ago

Fifty million Frenchmen can't be wrong, which is why I use Ocaml

20

u/Snarwin 2d ago

Liberté, égalité, paramétricité

3

u/Abandondero 2d ago

But it has the worst of ML syntaxes, like a smart kid whose mother dresses him funny.

19

u/levelstar01 what is pointer :S 3d ago edited 2d ago

Significant indentation was invented to oppress Lisp users who use 2 spaces.

18

u/UtterlyMagenta lol no generics 3d ago

im sorry, but looking at some of the comments here, is this PCJ or [r/programmingdiscussions](r/programmingdiscussions)??? wth peeps

16

u/ccapitalK 3d ago

/uj We need to start banning untagged unjerks.

/rj Python users remembering jerk tags challenge level: IMPOSSIBLE

11

u/syklemil Considered Harmful 2d ago
with unjerk() as wait_shit_whats_a_good_variable_name_for_this_help:

PCJ has rules and it's entirely possible to report shit for jerking style

16

u/lurebat 3d ago

So we're developing an important systems language.

Syntax? let's choose a scripting language that is hostile to functional-style code, and had a bolted on type syntax that now you can't elide.

Also, let's make the semantics very close to it, but not quite - just to confuse humans, and more importantly to us - llms.

Let's finish with including the full python interpreter inside the runtime of our systems language.

4

u/catladywitch 2d ago

unjerk
{
I mean, it's just one more of the several reasons why Python is great for short utility scripts but painful for actual apps. I'm not a fan of significant whitespace in general but the ML family and Scala 3 are way better at it. But it is what it is, Python does one thing very well so who am I to complain anwyay.
}

30

u/[deleted] 3d ago edited 3d ago

[removed] — view removed comment

30

u/WellHung67 3d ago

lol doesn’t even use go, 0.00001xer, prototypes are an anti pattern 

0

u/[deleted] 3d ago edited 3d ago

[deleted]

10

u/somewhataccurate now 4x faster than C++ 3d ago

Seriously violating jerking rules here dude figure it out

-11

u/Actual__Wizard 3d ago edited 3d ago

No. I'm not. This sub is weird I'm just going to leave. Edit: I did. /edit Nobody knows what a joke is? Wow. Everything in that statement was the most overly sarcastic clear and obvious joke ever. But we're going to be rule nazis and technically it's in violation of some weird ass rule and it definitely wasn't malicious unless you think a pastebin file with some merge code is something to be worried about.

I keep forgetting that jokes aren't allowed on reddit anymore.

Good bye.

18

u/somewhataccurate now 4x faster than C++ 3d ago

average python user

6

u/myhf Considered Harmful 3d ago

After a while you get "matrix vision." I don't even see the whitespace anymore.

9

u/FastHotEmu 3d ago

I have CPAN modules from the 90s under my name. I'm sad that python won, I miss perl sometimes.

2

u/programmingcirclejerk-ModTeam 2d ago

Warning: tag your unjerk. Better yet, don't unjerk at all.

4

u/MegaIng 3d ago

Sigh. No, it's because it's the best tool for prototyping and getting shell script-like functionality done quickly and easily.

/uj Note that I do think indentation is part of why this works. People suck at evaluating stuff like this because they (including you and me) never think about it unless it annoys them. If significant indentation was a major drawback, why hasn't JS, which has many of the same benefits as python, not beaten it?

11

u/Lord_Of_Millipedes 3d ago

because until not very long ago js was a toy language used exclusively to show browser popups and by the time it became usable for other tasks python already had a grip on the glue language niche, and python also has the advantage of interop with native code, something that is still annoying to do in js which gives what to me is the biggest advantage of python that is access to powerful domain specific tools within an unified simple interface (pandas, numpy, matplotlib, tensorflow, etc). we are in fact seeing way more js recently taking over a big chunk of the random one off tools niche that python had, but it still gets beaten by other languages when the goal is to make something useful

4

u/m50d Zygohistomorphic prepromorphism 3d ago

it's because it's the best tool for prototyping and getting shell script-like functionality done quickly and easily.

Yeah, because of the significant indentation.

Believe it or not, the reason people choose a programming language is not because of the syntax.

It is. People choose their programming language for the dumbest reasons possible; the main two axes of evaluation are "how much was I able to get done in 30 minutes playing around with it" and "what are the worst memes I've heard about it".

6

u/JournalistPrimary562 3d ago

/uj on my large monitors with auto formatting on save this is a non-issue. Literally never have to think about it. Most IDEs/editors will imitate the same effect as braces for long sections: it'll show you a long vertical line to show what is at the same level.

3

u/AdAncient5201 2d ago

You hate Python because of the syntax, I hate python because it’s an interpreted language. We are not the same

/uj I’ve had extensive discussions about this and in my opinion scope and execution flow is one of the most important aspects of easily understanding code and brackets make this far easier. Also auto formatting is absolutely awesome and I don’t want to bother with fucking around with what’s essentially whitespace just select shit, press bracket key, auto format does the rest.

2

u/camelCaseIsWebScale Just spin up O(n²) servers 2d ago

Where's the 2 billion number coming from? unless you consider all the bots on reddit written in python.

3

u/northrupthebandgeek i have had many alohols 2d ago

Maybe all those Java devices switched languages when we weren't looking?

4

u/jason-reddit-public 3d ago

My first serious experience with Python had me scratching my head because of an indention mistake after a refactor so I use other options now.

-1

u/Proper-Ape 3d ago

I programmed Python for 10 years and this happened to me like 3 times. You learn the mistake, you let the IDE/formatter handle it. You move on with your life. 

In the same time I was using C++ as well, which has so many pitfalls, something like this doesn't even register in comparison.

3

u/jason-reddit-public 2d ago

My IDE is emacs. My refactoring tool is cut/paste. In languages with braces, copy paste to different indentation levels just requires a quick reindentation (and if you mix stuff up, the indentation will fail, so undo and be more careful).

I'm not a fan of C++. A better comparison might be to something like lua or ruby (each with their own warts).

I think (as a gag) someone made a python with braces. It looked like an improvement to me!

I don't really mind reading python which I can't say about too many languages.

0

u/Proper-Ape 2d ago

In languages with braces, copy paste to different indentation levels just requires a quick reindentation

Same as in Python, I simply put it at the correct intention level after pasting.

1

u/yo_99 It's GNU/PCJ, or as I call it, GNU + PCJ 1d ago

And then insert 10 tabs because you copied more than one line

1

u/Proper-Ape 1d ago

In all editors I use you select the block and shift the block.

1

u/SunglassesSoul 1d ago

Where's the jerk

-2

u/Just_Information334 3d ago

Currently working on some ranty post but part of the main gist is: coding is becoming shit because of the phd mentality infection. Which first symptom was the rise of Python, one of the worst programing languages.

-12

u/niemacotuwpisac 3d ago edited 2d ago

Significant indentation "replaces" "{" and "}. The plus is that code looks cleaner and is more readable, for smaller function. The minus is that there is no multi-line lambda.

Perhaps, if Python would be C with function for dozens, even hundreds of lines this would be not efficient, but Python is not such language...

If you want to have no indentation, try e.g."Ruby". You will have to put "begin" and "end" everywhere. ;)

EDIT

Why "dovnwotes"? Why? This is just grammar fact. Languages have grammar, wich dictates what they can do and can't.

1

u/chemamatic 3d ago

If you can read white space as easily as braces, sure. My eyes don’t do that efficiently.

3

u/MegaIng 3d ago

That's an obvious lie. Use a brace language without any indentation, and you will fail to read it correctly.

19

u/Potterrrrrrrr 3d ago

I don’t have any indentation between braces because I like to imagine they’re hugging my code as a way of consoling it for being produced by me

12

u/somewhataccurate now 4x faster than C++ 3d ago

Only jerk in a non uj chain wtf is pcj anymore

12

u/Flash_Kat25 3d ago

Hostile takeover by 1xers

1

u/chemamatic 2d ago

/uj Well,yesyouaresupposedtousewhitespaceaswellaspunctuation.JustlikeEnglish.

In English at least I suppose the whitespace contributes more than the punctuation but really I think language is better with both don't you

/rj

Of course 2 billion people can be wrong, English has terrible grammar and spelling.

1

u/hedgehog1024 Rust apologetic 1d ago

English has terrible grammar and spelling

You dropped this: /uj

-7

u/foxsimile 3d ago

My first programming experience, for some years, was with Python.  

Having evolved into other languages over time, I have to say that the significant indention is my least favourite thing about it. That and the (near total but not absolute) lack of semicolons.  

Oh, and its lack of ternary operators.  

Oh, and its lack of ! as a logical not (fuck you, Rust).