Python complements C++ for productivity

Ken Seehof kens at sightreader.com
Tue Jun 20 18:13:53 EDT 2000


Excellent idea.  Why didn't I think of that.  It would certainly make STL look
clumpy.  Of course python has no need for templates since it has nice
heterogenous container types (list and dictionary) and the ability to create
more of them easily.  Not having to tell the compiler what you are doing (i.e.
dynamic typing) is a big ease-of-use advantage.

John Schmitt wrote:

> When I first opened Pythonwin, I used the Python/Perl phrasebook.  Very
> useful to me.  I don't know the STL very well (I don't even know what the
> SWIG is) so I couldn't write one, but how hard would be to write a Python
> <-> C++/STL phrasebook?  I imagine it would be useful for C++ programmers
> who want to move to Python and useful to Python programmers who have to move
> some stuff to C++.
>
> John
>
> > -----Original Message-----
> > From: python-list-admin at python.org
> > [mailto:python-list-admin at python.org]On Behalf Of Don Bashford
> > Sent: Tuesday, June 20, 2000 2:01 PM
> > To: python-list at python.org
> > Subject: Python complements C++ for productivity
> >
> >
> > I've been using C++ for about 10 years, and Python less than a year.
> > I recently had the experience of implementing an algorithm for
> > Delaunay triangulation in both Python and C++.  I was working from my
> > reading of someone's Ph.D. thesis that had parts of the algorithm in
> > pseudo-code, and part in English.
> >
> > I started out in Python.  The work was pleasant and went fairly
> > quickly.  It was pleasing that a lot of the Python I wrote ended up
> > looking very close to the pseudo-code in the thesis.  The interpreted
> > nature of Python was very helpful, since it made it easier to inspect
> > results as I went along.  I also benefited from a Python graphics
> > package written by a colleague that hepled me visualize what the
> > algorithm was doing.  I think in the early phases, development in
> > Python was faster than it would have been in C++.
> >
> > But the resulting code was slow---about 100 times slower than the
> > thesis author's C code.  I started re-implementing in C++.  The
> > similarity of the basic "class" ideas in the two languages made the
> > re-write very easy and fast.  In some cases, I just dropped the Python
> > code into the C++ file and edited it.   In the translation process,
> > the stricter type rules of C++ helped me find some bugs that I might
> > never have found in the Python version, and it also resulted in
> > improved design.
> >
> > The only real unpleasentness in the whole process was when I had my
> > implementation partly in Python (higher level) and partly in C++
> > (lower, more number crunching levels).  Then I was using SWIG to
> > "wrap" the C++ parts for use from Python, but getting proper handling
> > of translations like Python lists to C++ containers was quite a pain
> > (although I learned a lot about SWIG typemaps in the process).
> >
> > In short, I found Python to be a great prototyping language, with
> > pretty easy movement to C++, which is a great language when you want
> > strict type checking, data hiding and performance.
> > --
> > http://www.python.org/mailman/listinfo/python-list

--
Ken Seehof
kens at sightreader.com
starship.python.net/crew/seehof
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: kens.vcf
Type: text/x-vcard
Size: 343 bytes
Desc: Card for Ken Seehof
URL: <http://mail.python.org/pipermail/python-list/attachments/20000620/15a4c713/attachment.vcf>


More information about the Python-list mailing list