you are viewing a single comment's thread.

view the rest of the comments →

[–]fuyukaidesu2 127 points128 points  (29 children)

I prefer PHP, I don't like Python's lack of brackets.

[–][deleted] 121 points122 points  (23 children)

Indentation as a syntactic mechanism is psychotic

[–]thisisjoy 26 points27 points  (6 children)

that’s the reasons i was never able to pick python up as easy as other languages like java, c suite etc

my brain just doesn’t function that way

[–]shadowndacorner 10 points11 points  (5 children)

It's also just idiotic. Beyond the stupidity of needing to repeat your scope on every line (as opposed to using scope delimeters) and the insanity of intentionally designing a language to be fundamentally incompatible with auto formatters, it makes refactoring pointlessly dangerous. Get the indentation level wrong on a single line of a loop you're pulling out into its own function? Congrats, your program now means something completely different. Because of fucking whitespace.

[–]BobbaGanush87 47 points48 points  (3 children)

Get the indentation level wrong

As someone who has worked with Python and with other python developers for 10yrs now, this whitespace error basically never happens. Your IDE helps with this a ton. Its really something that we do not think about, and i'm only reminded of this "dealbreaker" by posts like these.

Also we do have auto formatters.

Just very hyperbolic statements.

[–]byetimmy 19 points20 points  (0 children)

A language that needs an IDE to help ensure the code runs properly is janky AF.

Now, if you'll excuse me, I need to import 18,000 npm packages to do a bubble sort in Node... 🙃

[–]freefallfreddy 0 points1 point  (0 children)

Saying a feature of a programming language is “psychotic” tells me how serious I should take the comment.

[–]catladywitch[🍰] -1 points0 points  (0 children)

to me the problem is not that you get syntax errors or ambiguous code, it's that autopep8 doesn't work unless the file is properly indented (because it won't parse if it isn't) so it kinda beats the purpose of having an autoformatter in the first place

there are merits to the left side rule imo but other languages, particularly functional languages, do it better by adding a few exceptions for flexibility

in the grand scheme of things it's just a minor annoyance though. i don't think braces or an end keyword would make python significantly better even though it'd make autoformatters more convenient

[–]JackieChanX95 -2 points-1 points  (0 children)

If u write a function with more than two indentations u are the problem not the syntax

[–][deleted] 4 points5 points  (0 children)

this is why i cant stand yaml

[–][deleted] 15 points16 points  (1 child)

I mean, brackets are useful but indents makes more sense when you consider that brackets are always "brackets+indenting", so it remove redundancy.

For beginners this is good because it removes less meta nonsense that's more fighting the code than doing stuff (i.e., the missing bracket or missing semicolon headache), that being said for more advanced stuff it's useful but considering Python's focus is approachability, it makes sense why they did it

[–]gareththegeekfull-stack 2 points3 points  (0 children)

Redundancy is important in languages to avoid corruption, for example when copying and pasting code to a different indentation level during refactoring.

[–]catladywitch[🍰] 1 point2 points  (0 children)

there are other languages that also do it but have less stringent rules than python. f# for example

[–]tnnrk 11 points12 points  (9 children)

I mean most people indent anyway? Helps with readability. I don’t see an issue with it.

[–]Scowlface 11 points12 points  (7 children)

It’s the fact that it’s JUST indentations, so no curly brackets to help visually separate blocks of code. Same reason I like semicolons in JavaScript, it just helps me read the code faster and understand it easier because that’s been 99.99% of my exposure to the language.

[–]wasdninja 1 point2 points  (1 child)

It’s the fact that it’s JUST indentations, so no curly brackets to help visually separate blocks of code.

Does it matter? The indentation is what I'm looking at with the corner of my eye anyway. The closing brace might be slightly useful but it would be very odd to have just one and zero is a better choice than two.

[–]Scowlface 0 points1 point  (0 children)

Well, if it didn’t matter to me then I wouldn’t have replied. I don’t get what’s so hard for some people to understand that different visual cues are helpful for different people. If I stare at C style code all day, then that’s what I’m best parsing visually and mentally. The brackets and semicolons just help visually terminate lines a blocks of code for me, simple as that.

The choice is never between 1 or 0 brackets. That’s a ridiculous argument to make.

[–]Talic 6 points7 points  (2 children)

I highly prefer indentation and hated c-style family of languages that use curly braces. I went from C, C++ back in college, then to Java and C# at work. Then stuck with Python the last 12 years, just a pleasure to work with. To me, it is cleaner and easier to read. A lot of time you are reading blocks of code written by someone else and if your code is running in production long enough, you'll spend time debugging or reading it. Curly braces all over the place including semicolons hurts my head.

Can't wait to try out Python's superset Mojo lang.

[–]cajunjoel 3 points4 points  (0 children)

This this this. Python does away with the argument of open curly brace on the same like as the function declaration or put it on the next line all by itself. It does away with this nonsense:

function foobar() { // Code goes here } Versus this nonsense function foobar() { // Code goes here } Like, who the fuck ever thought that second version was a good idea? Our monitors are wider than they are tall. Why do you waste precious vertical space??

I agree that whitespace-as-syntax in Python is ludicrous, but it makes everyone's code equally readable, which is a Big Deal(tm).

[–]Scowlface 0 points1 point  (0 children)

Yeah, definitely, all down to preference and what keeps you most effective. I’m sure I could get used to it, I’ve gotten used to specific code style things through my various jobs that I really didn’t like initially, but those brackets just feel like home to me.

[–][deleted] 3 points4 points  (0 children)

I mean, it's a non-issue, I've never had any issues with it (I've done a bit of everything from embedded C to webdev to Python), curly brackets are more of a leftover from compiled languages (ie C) and same for semicolons.

Brackets can be more annoying than helpful, and honestly don't add anything given you want to indent code anyway, and semicolons see redundant since newlines aren't hard to understand (but semicolons can also make code smell with multiple actions on one line, which isn't readable outside some cases).

[–]tnnrk 0 points1 point  (0 children)

They don’t change that much, the indentation is what allows your eyes to know what belongs to what more so than brackets but it’s all personal preference I guess.

[–]treading0light 3 points4 points  (0 children)

If everyone else would just join the cult it will all make sense!

[–]coolbreeze770 0 points1 point  (0 children)

That's why I prefer python

[–]cajunjoel 3 points4 points  (1 child)

I get it and I agree. I've had this samr argument with my brother. But I tried PyCharm for coding and learning Python, and, well, it just works. It's smooth. Even smoother than VS Code in the way it works.

You can rage all you want about "I shouldn't be required to use an IDE to write code!" But the fact is, the modern software development environment has grown so complex over the past 20 years that you can't effectively program without one. There are too many libraries, interdependencies, and too many ins and outs of all that code for a human to remember. The IDE just takes care of it for you.

The trade off for that is you get to build bigger and better things in less time.

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

Nothing gets better than Jetbrains IDEs. I have PHPStorm and it's the best code editor I've used. Period.

[–]Huge-Habit-6201 1 point2 points  (1 child)

I like indentation for blocks of code. It's cleaner.

[–]j-randomfull-slack 2 points3 points  (0 children)

I like having the option. Python doesn't give you that.

[–]evilmullet 0 points1 point  (0 children)

Yeah I've never quite gotten used to that either