Python vs. C++ Builder - speed of development
Alex Martelli
aleax at aleax.it
Sat Feb 1 04:52:38 EST 2003
Brandon Van Every wrote:
...
> really do feel that most of my time right now is spent on design, and that
> no
> language would allow me to code any more rapidly than any other. C++ just
Python has the potential to make your design more productive, too.
Whenever you have to choose between (algorithms, data structures,
or more generally "approaches") A, B and C, Python makes it quite
feasible to code them all and then choose between them on the basis
of actual experience, rather than mere theories.
> If you Keep It Simple Stupid in C++, it ain't that bad.
But you can't keep C++ all that "simple", really.
>> Transliterating into Python yielded about twice the productivity
>> wrt C++ (main gains: no worry about who owns what, no casts
>> needed, nested functions, everything works "template-like", i.e.
...
> You're naming a whole bunch of language features that I simply don't use.
You cannot "simply not use" ``worry about who owns what'' in C++.
SOME object X has to hold THE owning-pointer (e.g. auto_ptr) to
another object Y, while other pointers to Y don't "own" it -- you
have to KNOW when Y gets freed; or else you get to reimplement
reference counting and/or other approaches to garbage collection,
infrastructure which Python gives you in a much better developed
and usable state.
Of course you don't use nested functions in C++ -- it does not
support them. That's a _handicap_ of C++, by the way. Being
able to keep a function exactly where it should be (including
nesting inside another function) is a Python advantage, and such
extra power does not come from increasing complication -- the
very opposite: it comes from increasing SIMPLICITY by dropping
arbitrary limitations that C++ chooses to impose on you.
If you don't use templates in C++, that's your loss -- they're
(semantically, not syntactically -- C++'s syntax is a mess
anyway) among C++'s best features. And I do *NOT* believe you
do not use any casts in your C++ code, _particularly_ if you
make no use of templates. The point is, in Python you get
signature-based polymorphism for free (unless you choose to
handicap yourself by doing typetesting...), with all of the
advantages and none of the hassles it has in C++.
> complexity, and I'm doing solo development. Maybe it's fairer to say that
> Python yields more advantages in a cooperative environment. Whereas if
I would accept, as a working hypothesis, that Python has even
more advantage for larger projects, requiring cooperation of
various people, than for solo ones (but I have no numbers to
support or test that working hypotesis: productivity of a
group depends on so many factors, including many that are not
strictly technical, that studying the effects on it of a single
technology choice becomes very hard indeed). But even "just"
the factor-of-two advantage you can count on as a minimum is
still nothing to sneer at; any FURTHER productivity increase
when a project grows to "group" scale should then be seen as
just further inducements.
Alex
More information about the Python-list
mailing list