3 ms·
Ruby vs Python
- lutusp 13y agoA quote: "Often one the most debated, but I think largely irrelevant issues, is the significance of whitespace." I think it's pretty relevant. I use Python and prefer it to Ruby, but I think the presence of syntactic whitespace is a mistake. For one thing, it prevents a scanner from performing a consistency check against a source file that may have been corrupted or edited by someone unaware of the whitespace issue. For another, a source file that mixes spaces and tabs can be a nightmare to sort out, once a person evolves to the point that they realize tabs are evil and resolves to do something about it. Finally, there is the readability/editability issue caused by syntactic whitespace. In a complex code block, the indentation of various parts of the block ends up defining the algorithm, not always in ways the programmer intended, and an inadvertent whitespace insertion or deletion changes the program's meaning. The whitespace idea was originally well-intentioned -- it was meant to reduce a programmer's effort level when Python was a tiny fraction of its present size and importance, when no one expected to be writing large, complex programs in Python. Now, in my opinion, it's the elephant in the room.
- mjhea0 13y agoI hate syntax arguments when semantics is so much more important, but your arguments are interesting. I'm both a Python and Ruby developer, and I generally do not prefer one over another. Much like web frameworks, I use the language most appropriate for the task at hand. What syntax boils down to is the programmer. For example, how can you check for consistency in this code - def thisfunction(foo, bar): { foo.boing()} { for i in bar.fizzle(foo): { { baz = i2 } foo.wibble(baz) return foo, baz } } How would a scanner determine the bracket issue? Honestly, I am not a fan of invisible syntax, but for a seasoned programmer it saves me time coding because I don't have to enter whitespace and a closing bracket or a end space, etc.
- lutusp 13y ago> ... for a seasoned programmer it saves me time coding because I don't have to enter whitespace and a closing bracket or a end space, etc. Yep, I agree. When I'm coding something new, intent on getting something working as soon as possible, I appreciate the fact that it saves typing. Later on, when I'm trying to maintain, debug or expand old code, different story.