Python newbie

Alex Martelli Alex.Martelli at think3.com
Mon Dec 27 02:58:27 EST 1999


John Ratcliff writes:

> Thanks for all of the informative messages.  It certainly sounds like
> Python
> may be the language I want to use.  A few more quick questions.  Is there
> a
> C++ implementation of Python?  I really prefer *not* to put a large
> collection of C code into my C++ application if I can avoid it.
> 
LLNL has developed, and distributes (as well as the Numerical
extensions, the Image-Processing ones, and maybe others I
forget), "CXX", which contains all you need to use C++ for
interfacing to Python.

Python's own core is still C -- as it probably, sadly, still needs
to be to be as portable as it is, today... just look around
www.mozilla.org for their "C++ portability rules", and tell me
if you'd rather program in that stump of an arbitrarily restricted
language subset, or, even more portably, in good clean
standard C.  I mean, "C++" without templates, without
exceptions, without RTTI, without...?!  Plus, if Python's core
should expose its entry points as anything but "extern C",
it would become tied to a signle specific C++ compiler per
platform, due to name-mangling and object-layout issues, &c.

I'm a reasonably rabid C++-ers myself, mind you, but that only
holds when I _can_ use C++ -- say, 99.44% of the standard
(I don't hold out for 100% -- e.g., I grumble each and every
time about VC++'s lack of support for covariance of return
values, partial specialization of templates, etc, but I still code in
its decently wide standard subset).  If I still needed to write
code as portable as the Python core commendably is, as I
did a few years ago, I would still code that in standard C, as
I did then (I once had to take a largish subsystem I had coded
in C++ and recode it from scratch in standard C because the
alleged "C++" compilers on several platforms just wouldn't
hack it -- and I vowed, "never again"!).


> Are there Python variants that might be better suited, like this Viper
> language I heard mentioned on the list?
> 
Depends, I guess, on how stable a platform you need; if Viper's
"alpha" stage of development suits your needs, then it might be
quite an exciting platform to work on.  Personally, I need to
develop too much production code, these days, to do much more
than "play", with anything but very solid platforms -- so, I deeply
appreciate Python's fabulous stability and solidity (wish all the
platform components I code with/for were half as reliable as it).
But, if I was writing more proof-of-concept, throw-away
prototypes, as was once the case and may be true again
in the future, I would no doubt feel differently.


> If Python is a dynamically typed language, how does it handle sending
> specific types to a native function call or from a native call into
> Python?
> 
Basically, "opaque pointers", in many cases.  The struct and array
standard modules can also often help.


Alex





More information about the Python-list mailing list