Extending Python with C++ singleton pattern using boost python lib

Alex Martelli aleaxit at yahoo.com
Mon Apr 23 16:44:39 EDT 2001


"Joerg Sauer" <NeXTStep at programmatic.de> wrote in message
news:3ae4821c.1208889641 at news.netcologne.de...
    [snip]
> But is there anybody out there who got a c++ singleton running in
> python for windows and boost?

I guess one _could_ waste the time to write and debug
the needed templates to allow a non-copyable c++ class
to be exposed via Boost to Python.  Like trying to fit
non-canonical c++ classes in standard c++ containers
(all of Boost takes inspiration from the standard c++
libraries), it's a HUGE job for zero return, but, hey, we
wouldn't be human beings if we didn't sometimes do
that.  Just one hint -- when you think you're finally
there, you probably have two subtle bugs lurking in
wait to bite you when you least expect it, so _don't_
put it in production code -- stick to proxies for that.


Alex







More information about the Python-list mailing list