Python wrapper for C++ STL?

shindich at my-deja.com shindich at my-deja.com
Fri Dec 8 22:41:28 EST 2000


In article <fUgY5.126218$U46.4241063 at news1.sttls1.wa.home.com>,
  "Greg Jorgensen" <gregj at pobox.com> wrote:
> <shindich at my-deja.com> wrote
>
> > With all due respect, what would be wrong with a definition like
> > std::map<PyObject*, PyObject*>? Obviously there is no type safety
here.
> > But Python is not type safe.
>
> How does that help the Python programmer? Using C++ and STL to write
Python
> modules is one thing, but the original question was about wrapping
the STL
> so it could be used from Python. STL is not a set of callable
libraries that
> can be wrapped--it's a collection of template definitions that are
> transformed into C++ by the compiler. Once the C++ module is compiled
the
> STL functionality is invisible and irrelevant to the Python user.
>
> In other words, writing a wrapper for a C library function like printf
(), or
> an OS function like TickCount(), makes sense. But writing a wrapper
around a
> compiler feature doesn't make sense. Take STL out of it and imagine
writing
> a wrapper around the C/C++ for loop. It's possible, but it doesn't
extend
> the C/C++ for loop into Python.
>
> --
> Greg Jorgensen
> Deschooling Society
> Portland, Oregon, USA
> gregj at pobox.com
>
I am not saying that there is any point in wrapping STL for Python. All
I'm saying is that STL can be used to write C++ extensions that
implement specific algorithms.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list