[C++-sig] Why Python for C++ programmers

David Abrahams dave at boost-consulting.com
Wed Dec 11 14:19:57 CET 2002


"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> writes:

> --- David Abrahams <dave at boost-consulting.com> wrote:
>> "Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> writes:
>> 
>> > --- David Abrahams <dave at boost-consulting.com> wrote:
>> >
>> > I also find that debugging/testing my C++ algorithms is a lot faster if I
>                                               ^^^^^^^^^^
>> > expose the new classes to Python from where they can easily be exercised
>> with
>> > different inputs. Almost all regression tests for my C++ algorithms are
>> written
>> > in Python.
>> 
>> Surely the Python binding layer hides some of the variations on
>> possible C++ inputs (e.g. const vs. non-const), making it impossible
>> to fully-exercise some C++ interfaces?
>                              ^^^^^^^^^^
>
> I find it easier to debug my /algorithms/ from Python. This is very different
> from exercising interfaces.
>
> - Most of my algorithms require very complex inputs. It would take a lot of
> time to write C++ code for generating these inputs.
>
> - If things go wrong it is easy to insert print statements in Python to narrow
> down the problem. This is much more time-consuming in C++ because of the
> compilation/linking overhead.
>
> - From Python I can easily try different inputs without inventing file formats
> or recompiling. Being able to quickly change inputs or to systematically try a
> range of inputs often is the key to finding out which of the many parts of a
> complex algorithm is not functioning properly.

Does this all come down to the fact that Python has extremely powerful
literal expressions which allow you to easily build up new composite
objects, and you don't have to recompile it to build new ones?

-- 
                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution





More information about the Cplusplus-sig mailing list