Python wrapper for C++ STL?

Rainer Deyke root at rainerdeyke.com
Fri Dec 8 22:25:59 EST 2000


<shindich at my-deja.com> wrote in message news:90s2lm$ig1$1 at nnrp1.deja.com...
> In article <npfY5.1850$x6.2577114 at news2.rdc2.tx.home.com>,
>   "Rainer Deyke" <root at rainerdeyke.com> wrote:
> > "Edward C. Jones" <edcjones at erols.com> wrote in message
> > news:3A31760E.D157EB54 at erols.com...
> > > Has anyone written a Python wrapper for the C++ Standard Template
> > > Library?
> >
> > Why would anybody want to?  Python provides most STL fnctionality
> natively.
> > Such a wrapper would need to constantly translate C++ exceptions to
> Python
> > exception and vice versa, making the wrapper be more trouble than it's
> > worth.

> STL has other things that are of great use to C++ developers -- sets
> and a bunch of generic algorithms to name a few. But STL looses its
> beauty without the type safety. And Python is not type safe. I guess
> the only feature that I really miss is std::set. But a set can be
> implemented as a dictionary that uses the same object as both the key
> and the value.

I tend to use a dictionary where all values are None for sets.

The STL does have some nice features which are missing from Python.  For
example, C++ sets and maps are automatically sorted.  However, I feel that
it would be easier to write a Python extension that provides these features
from scratch than to write a wrapper for the STL.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list