I have ruby for having "end". It's just taste.
I like Python because it forces people to write well indented code. I worked with too many pigs.
I have ruby for having "end". It's just taste.
I like Python because it forces people to write well indented code. I worked with too many pigs.
It's like driving on the autobahn without guardrails. You may only need them once or twice in your life and yet, you're happy the guardrails are there. Just in case.
Allowing both tabs and spaces was simply a mistake but it is too late to turn the clock back on that now.
http://wiki.c2.com/?PythonWhiteSpaceDiscussion
In general, significant whitespace isn't fantastic but at least now we have widespread version control which helps in case of accidental deletion/insertion of a space or a tab or a newline.
So Python has ... nothing. I program a lot in Python but this is one headache I could have done without. It also always makes me read a little bit further than I have to when looking at some block of code because you never know that something else might follow until you drop that indentation level back down. So now you have to count indentation levels.
And in many languages, those are optional in certain contexts (as someone else mentioned: see heartbleed).
if (a == b)
do_this()
and_always_dothis()
...Who exactly considered it a bad idea and why?
This is my major pain point with Python. No code blocks as arguments and single line lambdas are the second one.
And those underscore looks so 80s, but that's when van Rossum started designing Python. Same thing for the self argument in method definition: it's the pointer to the struct holding the function pointers and instance variables in object oriented C (without ++).
On the other side
object = ClassName()
is more convenient than object = ClassName.new # Ruby
object = new ClassName(); // JavaHaving to edit a bit a code you copy paste from an badly formatted source (which you should do anyway for safety) is a small price to pay to avoid all the dirty coders in the world to write blocks with a showel.
I know that I should select the region and do C-c > to move it one level to the right, but it's not convenient. In any other language the editor indents it with one keystroke (actually it's 3 keystrokes: C-M-\ because it's emacs...) That's why TAB, ARROW DOWN is faster, when it doesn't add bugs.
I have never encountered either of these problems, pasing issues are trivially solvable ("+p), and who uses tabs?
I also often run in to code that mixes tabs and spaces, not just in Python, but it many other languages as well, and it is super annoying when it happens.
That said, before I learned Python, I absolutely hated the idea of meaningful, forced whitespace. But once I actually learned Python, it turned out it wasn't a big deal, as I tended to indent that way anyway. But it is annoying on occasion when working with other people's code, for the reasons mentioned.