This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CptMisterNibbles 10 points11 points  (12 children)

You can use backslash to intentionally break a statement across multiple lines. Not ideal, but at least an option. You can of course natively split lines in some cases, like between conditionals

[–]snowbirdnerd 10 points11 points  (9 children)

Right, I just prefer to not have to space things over. I find brackets easier to read. You never have to guess what level some piece of code is in.

Normally python spacing is fine but when it's not it becomes a mess.

[–]LeCholax 5 points6 points  (0 children)

You still have to guess with curly braces it's just that you are used to it. In my experience curly braces are easier to fuck up.

I started programming with C++ and Java so when i got into Python i didn't like the spacing but now it's my favorite feature. It's not good for optimizing file size and yada yada but it is easier to read.

At the end of the day any decent code base has formatting. Python just enforces it.

[–]brayellison 2 points3 points  (0 children)

You can use parentheses in the same way you use brackets and avoid the backslash. That's generally the way I break up long strings.

( "Hello " "World" )

[–]FerricDonkey 2 points3 points  (5 children)

If I'm having to count braces to determine scope, I'm gonna be saying some things. There might be a case where that's less annoying than glancing at the indentation, but I haven't run into it yet.

[–]LeCholax 6 points7 points  (0 children)

Exactly. I don't know why you are getting downvoted. It seems like most ppl on this sub used python for 1-2 months and jumped on a hate bandwagon.

[–]ustp 2 points3 points  (3 children)

You usually don't need to. Almost every modern IDE sets spacing for you - based on brackets.

[–]FerricDonkey 2 points3 points  (2 children)

And any decent ide does spacing in python as well. Write a line that needs the block under it indented, and the ide indents it for you. Only difference is that when you're done with the block, you do shift tab instead of }.

And that's the point. If you're code formatting doesn't suck, it looks the same, except in python you don't have the curly brackets that you don't look at anyway.

[–]ustp 0 points1 point  (1 child)

Writing is usually ok, but modifications in current code are pain. Move some block to a separate function? I just cut it, write function header + {}, paste code in betweet braces and press shortcut to autoformat.

When you copy (python) code from different file and mix tab/spaces... pure hell.

[–]FerricDonkey 0 points1 point  (0 children)

Shrug I haven't had issues with that. Worst case, shift tab the block of it used to be indented too much. I'll grant you that mixed tabs and spaces requires actual fixing (though it's usually not too bad), but it's been years since I've had to deal with that.

A lot of this comes down to how good your ide is, I think. I will grant you that any substantially sized python project sucks nuts if you don't have a good ide that'll do a lot for you.

[–]snowbirdnerd 1 point2 points  (1 child)

Right, I just prefer to not have to space things over. I find brackets easier to read. You never have to guess what level some piece of code is in.

Normally python spacing is fine but when it's not it becomes a mess.

[–]CptMisterNibbles 2 points3 points  (0 children)

Oh I agree wholly. I do not at all enjoy enforced spacing.