Python suitability

Alex Martelli alex at magenta.com
Sun Dec 26 03:19:13 EST 1999


John Skaller writes:


> > 6. Many of the things you do in C++ are to over come it's own
> >     limitations.
> 
> The main limitation of C++ wrt python is the ugly syntax,
> and the quantity of it that is required to do something which is
> simple in Python. After all, Python is written in a subset of C++.
> Python simply 'pre-makes' some design decisions for you.

An interesting way to put it.  But, actually, it's an _extended_
subset, because it makes use of some things that (alas!) are
not in standard C++: things such as deploying separately
compiled modules, and accessing certain elementary OS
functionality (such as getting a list of files).  Standard C++
refuses to provide a standard model for dynamically loaded,
aka 'shared', libraries; similarly, it refuses to model such
elementary system services as obtaining a list of files, or
meta-data (size, time, etc) about files; any sort of
communication with networks or databases; etc.

Further, even for things which _are_ fully implementable in
standard C++, such as regular expressions, part of the point
about Python is that it has, not just 'pre-designed' them for
me, but, also, _implemented_ and _tested_ them; when I
use such functionality, I'm re-using very substantial amounts
of implementation work, as well as the design decisions
behind it.

The 'subset' relationship probably does hold for JPython, since
Java is not as shy as C++ about offering standard and
portable models for these issues (and others, such as
threading); so, for that case, the 'pre-made design
decisions in a language subset' model may be closer to
fact.  The extreme richness of functionality provided in
the Java standard library, versus the spartan spareness
of C++'s, also points the same way.


> This is an advantage if these decisions suit your application,
> and a hassle if they don't, and you have to work around them.

Probably a fair point about any 'higher-level language'
whatsoever (including C++ versus assembly).  The key
issues here would seem to be, how wide is the range of
applicability of the 'pre-made design decisions' (how often
are they limiting rather than empowering), and how
much of a hassle is it to work around them when need
does arise.  I think Python (and C++, when scored against
machine language) does very well on both scores, while
other "higher-level" languages may not be as suitable.


Alex






More information about the Python-list mailing list