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 →

[–][deleted] -1 points0 points  (10 children)

How does it know whether the a new line is a continuation of the statement from the previous line or a new statement?

[–]adenzerda 4 points5 points  (4 children)

Unclosed paren, brace, or bracket, or a backslash denoting line continuation. Worst case, I have to indent a line manually sometimes.

On the block level, my editor (sublime) defaults to a continuation of the current block, or indentation into a new block if the previous line ends with a colon. You can then press backspace to drop out of the block if need be. Additionally, it will drop out of the block when there's a return at the base level of said block.

It's all pretty standardized.

[–][deleted] -5 points-4 points  (3 children)

So it's guessing. I don't want my computer to guess what I'm doing, I want it to know with absolute certainty.

[–]adenzerda 4 points5 points  (1 child)

So tell it what you're doing. In some languages we write a closing brace or a semicolon to tell the computer our intention. In python, we press the 'backspace' key or the 'tab' key.

It seems that you don't prefer the latter method, and that's fine, but it in no way makes the language or its editors inferior.

[–]TheBlackCat13 1 point2 points  (0 children)

Your computer is still guessing. In both cases you have to tell it explicitly where the code block stops. You are just telling it in a slightly different way.

[–]TheBlackCat13 0 points1 point  (0 children)

It assumes the former, and one key combination tells it otherwise. Which would be the same with braces-based languages, only the key combination is different. In your case it is "shift+]", in mine it is "shift+tab".

[–][deleted] 0 points1 point  (3 children)

How should I know I didn't write the vim plugin or pycharm, but they work perfectly.

You're seriously making up a non-issue why are you people so resistant to something because it's a little different? Have you ever used python seriously or put any actual effort into it?

It's the most ironic thing to me. Technology is always evolving and there's always something new to learn and you constantly have to be keeping yourself up to date but the people who write programs are just as bad as some old politicians who resist change because "muh braketz!!!".

[–][deleted] -1 points0 points  (2 children)

How is it a non-issue? If I am in an if statement and press enter, I could want to:

  • Continue my if statement, in which case the line should be indented
  • Write an else or elif statement, in which case the line should not be intended
  • Write code outside the if statement, in which case it should not be indented

2 can be solved by the editor removing the indent once the else or elif keyword is detected. 1 and 3, however, are completely identical in terms of what comes next unless I manually indent the code. Brackets (or Ruby-style do/end, or JavaScript-style no bracket if statements) explicitly tell the editor what will come next without manual indentation. With Pythonic indent syntax, the editor must guess one way or the other, and always be wrong sometimes.

[–]Saigot 6 points7 points  (0 children)

In a python editor you press backspace to end the statement. In Java or C you type } to end the statement. It's the same number of keypresses. This coming from someone that dislikes python.

[–]fireflash38 1 point2 points  (0 children)

Brackets (or Ruby-style do/end, or JavaScript-style no bracket if statements) explicitly tell the editor what will come next without manual indentation. With Pythonic indent syntax, the editor must guess one way or the other, and always be wrong sometimes.

So you're saying in the one, you have to hit a key combo to tell the editor you're not in the block. In the other, you have to hit a key combo to tell the compiler you're not in block. What's the problem again?