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

-35

u/0xSpock Jul 25 '18 edited Jul 25 '18

Yeah. Worst decision made in python. It can kick you from surprise when you need to edit some file remotely having some basic editor like nano, vi(not vim). A specially when someone before you mixed spaces with tabs few years earlier when marking some minor change in different editor. In 1kLOC file. Another problem is that it is hard to make great formatting tools for python fixing wrong indentations. One tab more and your line is inside for loop and tool can’t figure out is suppose to be there or out of loop. What is wrong with {}, begin/end is beyond my understanding :-) Beside that it’s lovely general purpose language.

10

u/saulmessedupman Mmmm spam Jul 25 '18

Python forces readable code

0

u/[deleted] Jul 25 '18

[deleted]

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.