I come not to bury C++, but to praise it...
Derek
none at none.com
Wed Jan 14 13:02:50 EST 2004
"Jp Calderone" wrote:
> > I also use C++ and Python as my main languages and I
> > agree with your comments. However, I don't agree that
> > Python is inherently "safer" than C++. At best I see
> > it as a tie. For example, C++ let's you corrupt memory
> > among other "unsafe" things, most of which can be avoided
> > by using standard containers, smart pointers, etc.
> > Python lets you do "unsafe" things such as passing an
> > object to a function when it makes no sense to do so,
> > which can lead to nasty runtime surprises.
>
> A traceback is *much* less nasty than memory corruption.
> One stops the program immediately and shows you exactly
> where the problem lies, the other may let the program run
> for quite a long time before simply causing the process to
> die, leaving few clues as to the source of the problem.
>
> Python may not be *completely* safe (indeed, memory
> corruption is still possible due to bugs in the interpreter
> and extension modules), but it is quite a bit safer than
> C++.
Maybe I didn't make myself clear. I counted the ease with which
memory can be corrupted in C++ as a minus for C++ and a plus for
Python. I agree with you.
On the flip side, C++ can catch errors immediately that Python will
not complain about until runtime, and in this imperfect world tests
may not catch all such errors up front. In this respect I consider
C++ safer.
More information about the Python-list
mailing list