[C++-sig] Sub-modules

Eric Jardim ericjardim at gmail.com
Mon Mar 28 03:29:13 CEST 2005


Hi,

is it possible to define python sub-modules with boost.python?

BOOST_PYTHON_MODULE(out)
{  
    BOOST_PYTHON_MODULE(in)
    {
        def("f", &f)
    }
}

---

>>> import out.in
>>> out.in.f()

Or something like that? What is the correct way of doing that?

I thought that if we could do it separate


BOOST_PYTHON_MODULE(out)
{  
}

(out.cpp -> out.so)


BOOST_PYTHON_MODULE(in)
{
   def("f", &f)
}

(in.cpp -> in.so)


and place them like

.../site-packages/
    out/
        __init__.py
        out.so
        in/
            __init__.py
            in.so

Anyway, what is the "correct" way of doing that?

[Eric Jardim]



More information about the Cplusplus-sig mailing list