Python and spacecraft onboard or ground control scripting
Cameron Laird
claird at starbase.neosoft.com
Mon Apr 15 14:08:47 EDT 2002
In article <3cb8a237 at news.mhogaming.com>,
Ken Peek <Ken.Peek at SpiritSongDesigns.comNOSPAM> wrote:
.
.
.
>component sets.) Python is quite suitable for embedded
>systems work. When compared to a compiled systems language
>(like 'C'), some of the main differences will be:
>
> 1) Slower execution (4..10 times slower than 'C' code)
> 2) Larger memory requirements (dynamic objects instead of
>statically allocated variables)
> 3) Python uses 'late binding', so some errors will not be
>found until run time (that could have been found at compile
>time with a strongly typed language.)
> 4) Objects are dynamically created at run time, so you
>could have an "out of memory" surprise
>
>If these limitations are not bothersome to your application,
>then by all means-- set some engineers to work embedding
>Python into your space craft!
.
.
.
While this presentation is accurate, it's incomplete
in a way which calls out for comment.
I summarize my protest: 2), 3), and 4) are compari-
sons whose signs are indeterminate. Yes, for example,
Python objects are dynamically created, and there is
the potential for "out of memory". I have a personal
belief, however, that the memory analysis of general
C programs is no easier to compute than that of Python
programs.
More positively: my personal belief is that it's
feasible to demonstrate that coding in a particular
style of Python makes its memory behavior at least
as deterministic as that of the corresponding C
programs.
Yes, one can construct examples of cosmetically
similar faulty C and Python source, where a C
compiler squawks, but a Python developer might
reasonably be expected to fail to notice the error
until a run-time exercise. I claim this is an
egregiously artificial situation, though. Alex
Martelli frequently writes on this subject. I'll
summarize my own thoughts:
* wise Python developers use static analyzers;
* wise Python developers have good testing
habits;
* Python source is only a fraction as long as
C, so *of course* there are more errors for
a C compiler to catch.
As to 2), there are abundant counterexamples of C
coders using such inefficient algorithms that they
require MORE memory than their Python-coding peers.
--
Cameron Laird <Cameron at Lairds.com>
Business: http://www.Phaseit.net
Personal: http://starbase.neosoft.com/~claird/home.html
More information about the Python-list
mailing list