3D graphics programmers using Python?

Alex Martelli aleax at aleax.it
Fri Feb 7 09:46:20 EST 2003


On Friday 07 February 2003 03:02 pm, Laura Creighton wrote:
> Alex
> <snip>
>
> > Let me play devil's advocate:
>
> It is usually bad to take somebody out of context like that, but in
> this case I cannot resist.  grin.

It's quite appropriate -- I'm defending C++ use (vs C) in certain
(many) cases, and I _do_ say I'm playing devil's advocate...

> My experience with studying C++ says that study is not enough.
> You actually have to code your way into certain hells before you
> know the hell is there. This goes for C as well, but C's hell
> is smaller.

I think the many traps and pitfalls of C and C++ *CAN* be taught.  But 
then, the Romans did say "experientia docet stultos", "experience is
fools' teachers" -- and since all human beings (and bots too) are 
"stultos" to some degree or other, experience can indeed be
necessary to reinforce the lessons.  So, "study" to some degree or
other must also include practice.  But that goes for Python too -- one
cannot just read books (or even posts;-) for time X and emerge on
the other side as a great coder of Python -- even though it's simpler,
one still DOES need practical experience to be really good.


> Up until last month I would have given unqualified support to the
> statement 'if you can reduce your problem to something you can
> code in c, _do it_.'  Now it is qualified.  I have been playing
> with Boost, and that makes a lot of things easier.

Oh good -- I remember some beginning of debate on the issue
between us before then -- see, I _had_ been playing with Boost
(and other good template libraries in other domains) quite a bit 
earlier, so I _knew_ how much productivity can soar (compared
to doing things in C) if you can rely on such good libraries of
templates.  E.g., I *CAN* code a COM client or server in C (see
my Windows API tutorial on www.aleax.it -- in Italian -- for an
example, around chapter 30 if I recall correctly)... but in reality
I would only do it for didactical purposes, or a bet of some kind;
with C++ and Microsoft's ATL template library (a very good one),
I can easily be 10-20 times as productive at this task as I can in
bare C (goes for both coding and maintenance).  Python gives
me another factor of 2 or 3 for the same task, so that's what I
will use if feasible, but if it has to be coded in a compiled language,
since I know C++ pretty well, I'll have no doubt choosing C++.

Same goes for coding Python extensions -- I use C when I must
(e.g. because I want the extension to be used widely, since I
know C++ encounters resistance in the world of open source),
but C++ (and Boost of course) when I can.  I think the
productivity ratio between C and C++ is NOT 10 or 20 times
in this case (the Python C API is well designed, which is NOT
true of the API you need to program COM in bare C) but it is
still substantial in my opinion and experience.

Problem is, there IS still the need for mucho study to use C++
decently (with "study" to be taken as including experience;-).
So one must guesstimate how much one will amortize this big
investment in study-and-experience in the future...


Alex






More information about the Python-list mailing list