You are viewing a single comment's thread from:

RE: Python and Indenting

in STEMGeeks5 years ago

I like python, and one of the reasons I like it is the indentation. Makes it so much simpler. Of course your while loop wouldn’t work if you don’t increment i within the block. Wouldn’t you have the same problem in other languages?

Sort:  

Wouldn’t you have the same problem in other languages?

Not really, if the block is delimited by "{" and "}" or by "endif" or other constructs, the block ends where the matching "}" is found, not where the unindented line is.

For someone who is used to PHP, Javascript, C++ etc. syntax, indentation and white spaces are simply ignored by the interpreters / compilers. Quite a leap to go to the opposite, where indentation has a meaning in code.

Don’t you end up indenting in those languages for readability anyway?

Sure! I just prefer the visible delimiters of the blocks and, at the first impression, the fact that a little indenting error doesn't mess up my code.

Update: And I'm not saying here I don't like Python. There are things I like and don't like in any language.

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.031
BTC 61068.10
ETH 2655.77
USDT 1.00
SBD 2.58