The main problem for me is the ability to easily see what’s happening - if you see a func var() {} in JavaScript you know that whatever is in the brackets is part of that function, and you can structure that function as much as you want, along as it is in the brackets.
With Python, one indent to many causes compiling issues and it’s hard to keep track. For example I was writing a class and obviously this class had functions, so, while writing these I made a whole function but wondered why it wasn’t able to be called - It was due to the fact that it was indented one too many and became part of the past function. Now this isn’t a problem for a small script. But when you have sub functions and other things suddenly you can be indenting 4-5 times, this causes a lot of distraction and frustration when trying to figure out what belongs to what.
All in all I just love the ability to write
func var() {
... stuff to do
few comments
... little more stuff
}
func foo() {
... stuff to do
few comments
... little more stuff
}
instead of
def var():
.. stuff to do
few comments
... more stuff
def foo():
.. stuff to do
... wait what function is this?
Hey Bailey,
Can you please explain what bothers you about having to use indentation as a replacement?
Really interested.
The main problem for me is the ability to easily see what’s happening - if you see a
func var() {}
in JavaScript you know that whatever is in the brackets is part of that function, and you can structure that function as much as you want, along as it is in the brackets.With Python, one indent to many causes compiling issues and it’s hard to keep track. For example I was writing a class and obviously this class had functions, so, while writing these I made a whole function but wondered why it wasn’t able to be called - It was due to the fact that it was indented one too many and became part of the past function. Now this isn’t a problem for a small script. But when you have sub functions and other things suddenly you can be indenting 4-5 times, this causes a lot of distraction and frustration when trying to figure out what belongs to what.
All in all I just love the ability to write
instead of
I hope this explains it clearly :)
Yeah.
It's a matter of preference.
I had the (dis)pleasure of refactoring code that with not proper indentation, it colours my perspective.
It's a good thing choices exists.
Just be mindful of personal bias
And while proof reading this, notice one of my Python functions wouldn’t run due to an indent error?
Easy to miss...
So is an extra / missing parenthesis pair ;)