Boost logo

Boost :

From: Phlip (pplumlee_at_[hidden])
Date: 2001-03-26 14:30:40

Proclaimed Karl.Bellve_at_[hidden] from the mountaintops:

> --- In boost_at_y..., Phlip <pplumlee_at_o...> wrote:
> > Please use the example code under my sig for BPL's example1.cpp or
> > example2.cpp, with this test code:
> >
> > n = world(1)
> > m = n.getWorld(1)
> > assert (m != None)
> > m = n.getWorld(0)
> > assert (m == None)
> Phlip:
> Thanks for the pointer to this thread. But, I still don't understand
> something. From the above code, it appears Python is creating a new
> class called 'world'. You are then allowg the class called 'world'
> to create another 'world' in your code using 'n.getWorld'.

We demonstrate three behaviors here:

 - Python calls 'new' (the first line would have a 'new' if Python created
objects like that) and gets a C++ object thru BPL

 - A C++ method (getWorld) calls 'new' & returns a Pythonized pointer to it

 - A C++ object does not call new & returns a None, so Python can detect this

I ended that thread when I figured out how to safely return a None. Boost
does not (yet) translate a C++ NULL into a None. But I can't remember what
the thread said - we implemented BPL in our project (replacing SWIG
[yay!]) and moved on.

  Phlip                          phlip_cpp_at_[hidden]
============== ==============
  --  Whoever dies with the most features wins  --

Boost list run by bdawes at, gregod at, cpdaniel at, john at