SV: Python Productivity over C++

Hung Jung Lu hungjunglu at hotmail.com
Tue Jun 13 18:55:54 EDT 2000


--- In python-list at egroups.com, Neurocrat <neurocrat at o...> wrote:
>for (int i = 0; i < 10; ++i);
>         cout << "Hello" << endl;
>
>This, of course, prints "Hello" only once, not 10 times as we

When I started to use Python a few years ago, the thing that told me that 
Guido had some brain was exactly little tiny features like that.

Try to talk to some hardcore Perl or C++ programmers, and most likely they 
will balk back at you. "What? Python does not even support increment 
operator like i++? What kind of a retarded language is that?"

I have had hard time convincing to fellow C++ programmers that an assignment 
inside an "if" statement is a bad thing, to no avail. E.g:

    if ( a = getNumber() ) {...}

Sure, totally valid statement in C++, but why would anyone introduce such a 
stupid feature so you and your compiler get confused all the time with

    if ( a == getNumber() ) {...}

?

C++ programmer get bitten all the time with the == && || operators, and 
refuse to acknowledge that there is a problem.

Guido was smart enough to get rid of the confusing operators. You can't do

   if a = b:

and you have to use explicitly the "or" "and" keywords instead of the 
cryptic "&&" "||". And the superflous operators "+=" "++" are eliminated. 
(Why? If you are trying to save nanosecond execution time, or 3 bytes in the 
code by using Python, you are in the wrong business.)

And Perl people would issue you a stern warning about the indentation in 
Python, they'd say: "be very careful with the unusual indentation of Python, 
you miss one space and all hell breaks loose." Yeah right. I've been 
programming in Python for 3 years, now. It might have happened 2 or 3 times. 
Compare with Perl where every single program I wrote was a nightmare to 
debug, even if they are just a few lines. And guess what? No matter whether 
it is Perl or C++, I always do proper indentation and match up all the 
statements and parentheses neatly by hand, so do all the dozens programmers 
that I have worked with. So the parenthesis and the semicolons sit there for 
... I guess, to be pretty? :) For avoiding a bug that might happen once a 
year, Perl and C++ prefer that you introduce bugs that happen daily or even 
hourly. Great logics.

After I saw what Guido did with the == && || ++ operators, I knew some brain 
was put into Python. And since then, I have never looked back.

Hung Jung


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com





More information about the Python-list mailing list