r/Python • • Jul 25 '18

Use an IDE Me doing my CS projects.

Post image
1.2k Upvotes

213 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jul 25 '18

[deleted]

17

u/aphoenix reticulated Jul 25 '18

very few programmers outside python don’t indent correctly, so this is pointless.

I don't think the downvotes were from python fanboyism, but from that comment being obviously incorrect. If that's what you've experienced, then you're lucky.

0

u/[deleted] Jul 25 '18

[deleted]

4

u/jmmcd Evolutionary algorithms, music and graphics Jul 25 '18

Making teaching easy was a central goal of the ABC language from which Python descended, and is still a central goal in 2018 as witnessed by recent PEP discussions.

0

u/[deleted] Jul 25 '18

[deleted]

9

u/jmmcd Evolutionary algorithms, music and graphics Jul 25 '18

eventually everyone moves onto a language that has curlys anyway.

Not in my field (machine learning).

0

u/[deleted] Jul 25 '18

[deleted]

3

u/van_morrissey Jul 25 '18

You can use a language with curlys != Everyone moves to a language with curlys. Most people in machine learning who use Python stay with Python. R having them doesn't have anything to do with the statement above

→ More replies (6)

10

u/evinrows Jul 25 '18

If you can't write code with proper indentation unless the compiler interpreter forces you to, you're a moron. This feature is pretty damn pointless on Python, but I like other things about Python.

I always wonder why people feel so strongly about this. I agree, it's easy to get indentation right... so what's the problem? Who cares that it requires you to get the indentation right? Your experience won't change at all if you're not screwing it up.

If I had to rank language design decisions in terms of importance, I think whitespace vs curly braces would be one of the last items on the list. It just happens to be one of the simplest topics to understand which makes gives it a low barrier to entry for absurdly passionate stances.

2

u/orokro Jul 26 '18

Thank you.

Only Python coders are so obsessed with indentation. For every other language it's par for the course. Many people replying to me make it seem like Python is a sanctuary of proper indentation, and any code written in other languages is chaos with no indentation at all.

It's not hard at all to get indentation right, and for all the great things about Python, it's strict enforcing of indentation is not one of them.

1

u/HelperBot_ Jul 25 '18

Non-Mobile link: https://en.wikipedia.org/wiki/Law_of_triviality


HelperBot v1.1 /r/HelperBot_ I am a bot. Please message /u/swim1929 with any feedback and/or hate. Counter: 203875

6

u/hextree Jul 25 '18

very few programmers outside python don’t indent correctly

This is far from true. And there isn't even an established 'correct' indentation pattern, it's a style thing. You can easily have several developers indenting according to different styles.

1

u/orokro Jul 26 '18

I've seen several different styles of indentation within Python. Tabs vs. Spaces for instance. But when talking about spaces, there's many variations based on the number of spaces.

Of course, Tabs vs. Spaces is a topic of debate in all languages, so that factors out.

Whats left?

Well some people like their opening brace on the same line, like:

 someFunction(){

and others like it on the next line:

 someFunction()
 {

Outside that distinction, braces don't affect coding style at all. Both languages can debate Tabs Vs. Spaces Vs. Number of spaces, so it's moot.

Python is one of many languages I work in, and outside Python I really don't run into problems with indentation. Anyone who thinks non-Python languages have indentation problems has psychosis.

1

u/hextree Jul 26 '18

In Java when you have a line length limit for checkstyle, it's not always clear how to indent when you add a newline character to roll over to the next line, so from this alone you can end up with wildly differing indentations.

1

u/orokro Jul 26 '18

Checkstyle is not part of the language.

If you enforced a mandatory line-length on Python, it would suffer exactly in the same way.

What's your point?

1

u/hextree Jul 26 '18 edited Jul 26 '18

It would not suffer in the same way, because in Python you can not just add arbitrary whitespace and indents.

e.g.

String alphabet = "abcdefghijk"
+ "lmnopqrstuvwxyz";

Arrays.asList(arr).stream().map(...)
.filter()
.collect(..);

In Java you could have all kinds of valid indentation for those rollover lines. It gets very messy when you have multiple layers of nested parentheses.

4

u/saulmessedupman Mmmm spam Jul 25 '18

Lol, python compiler

0

u/[deleted] Jul 25 '18

[deleted]

3

u/saulmessedupman Mmmm spam Jul 25 '18

Ok, I'll give you a pass

2

u/mardukaz1 Jul 26 '18

Edit: 26 downvotes?

1

u/orokro Jul 26 '18

lol, I know, right? So many haters / indentation fan boys

1

u/mooburger resembles an abstract syntax tree Jul 25 '18

Have you looked at CPAN modules lately? hell look at the majority of javascript even. (Yes "full-stack"programmers are still programmers). Easy to devolve into unread-ability is one of the reasons why most people hate Perl now. (There's a reason why "perlmonks" is literally a thing.).

Braces encourage laziness. How many ajax calls have you seen where it's all crammed in on a single line? I have to deal with that shit every day. If they'd been forced to indent, they would have factored out their nested callback hell ages ago, but here they're content relying on an IDE tracking the number of braces they're inside of.).

1

u/orokro Jul 26 '18

Perl is horrible. I don't think braces encourage laziness, at least I've never really seen it. It's not hard to get braces right.

JavaScript is a hack to begin with, even when written well it's making the best out of a shitty situation.

Even when there's call back hell, I still see proper indentation for nested callbacks...

And besides, JS engineers (worth their salt) love their promises, specifically to avoid that. Soooo... only n00b JS coders would have call back hell to begin with, and the worst of the worst wouldn't properly indent it.

1

u/[deleted] Jul 26 '18

/u/Trollabot DeadLantern-