Fayd
Diamond Member
i've been playing with python from google's python class...and i still prefer c++. the syntax is so much simpler to understand.
it is just semantics, does not make programming language that bad. python is quick and dirty way to get something done. bordeline scripting language.
- I am sorry, but any intellectual hippie pot smoking computer-science-PHd-whatever that gets the urge to reinvent the for-loop is retarded & stoned out. IMO.
http://stackoverflow.com/questions/4504662/why-does-rangestart-end-not-include-endHm, I wonder what the reasoning was for making the "stop" parameter exclusive not inclusive? -5 to -1 for stopping at 0 _is_ a bit confusing....
Don't listen to esun, he's being a pedant. There's nothing wrong with preferring the for loop.
You're complaining cause it's different, not cause it's worse.
Define "worse". For my money, the unnecessarily cryptic solution is the worse solution. Especially in a language that supposedly prides itself on its explicitness.
IMO python loops are much less cryptic than C style for loops, you just have a preconceived notion of what is obvious based on your past experiences with other languages.
Python for loops make iterating over a collection much more readable as well.
The common case is python (for me) is to iterate over collections, hence:
for thing in things:
Which is a pretty natural/readable for-loop.
I also disagree about the clarity of a C style for loop if you have no programming experience... how is someone with zero programming knowledge supposed to know what the 3 sections of the for loop mean?
I would presume that the Python has a manual that is more approachable than the Rosetta stone?
(On the other hand reading Stroustrup or the Standard and then expecting to do C++ falls short on non-compliant compilers.)
Does even a single C++11 compliant compiler actually exist? I'm willing to entertain the possibility that someone has a slow and impractical one in a lab, but no major compiler is even close to compliant.There is neither loop nor range in abs, but the example in that documentation is clearly wrong too (unless that Arduino language differs deviously). @irishScott: By "non-compliant" I did mean all compilers that do not implement 100% of the Standard. In C++ that covers almost all compilers.