Is Python overhyped (just like Java)?

Neal Norwitz neal at metaslash.com
Sat Mar 29 17:56:58 EST 2003


On Sat, 29 Mar 2003 16:38:09 -0500, Ajay na wrote:

> Can some-one please explain why one would want to use Python? What is
> wrong with C++?
>
> In my opinion, the problem with C++ has nothing to with the language
> semantics.  The problem is that when people are confronted with a
> powerful language like C++, they tend to want to optimize everything to
> death. That's when they get themselves in trouble.

It depends.  What happens when you throw an exception in a constructor
or destructor?  Have you tried to deal with portability?  What version
of the C++ spec is implemented?  Many compilers still have problems
with templates.  Memory leaks and over-writes.

There's a lot of issues with using C++.  These issues shouldn't
prevent one from using it, but you should know a languages strengths
and weaknesses.  C++ is often used in appropriately.

> Those who use Python know they are sacrificing a lot in terms of memory
> and speed.  But if they took the same attitude toward C++, they can
> actually get a lot of flexibility, code reuse, simplicity, and all the
> other benefits of OO programming at over half the cost of using Python!

I disagree wrt memory.  Python and C++ memory usage is often comparable
in my experience.  C++ has a lot of overhead as well.  While Python
is certainly slower in many ways, any language can be slow by using
it poorly.  Since C++ is much more complex, it is easier to abuse
it.

> Nope...I'm not trolling...I want someone to give a solid and intelligent
> argument about why I should switch from C++ to Python!

This is not an argument for using Python over C++ or any other language.
One should always use the appropriate language.  I use Python, C, and
C++.  I have also used Java in the past.  Unfortunately, C++ is used
far more often than it should be.

It has often been said that a programmer can write the same lines of
code in any language.  So if a programmer can express more functionality 
with less lines of code, one is more productive.  This is the case with Python.
Also, by reducing the lines of code, there are less bugs.  I am very
focused on producing high-quality software.  I have to be.  Our company
provides software for a fixed-price with a warranty.  This means
we eat the cost of bugs.  We can produce higher quality software with
Python.

I refused to learn or use Python for 5 years, since I could do
everything I needed to in C and later C++.  I eventually decided
to give it a try.  I quickly realized I could write code faster and
with less bugs.  The code was clearer to read afterwards.  I could
express my ideas quite naturally.  Instead of writing:

	for (vector<object*>::iterator i = obj_list.begin();
             i < obj_list.end();
             i++)
            (*i)->do_something();

I can write:

	for i in obj_list:
	    i.do_something()

This is one trivial example.  C++ is quite powerful.  So is Python.
They use different techniques to achieve that power.  Perhaps,
before asking what you are giving up in using Python, you should
examine what you are giving up by using C++ or any other language.

Neal




More information about the Python-list mailing list