June 4, 2013
5:45 p.m.
On 06/04/2013 01:12 PM, John Reid wrote:
Inner classes seem to be given the wrong name or perhaps this is by design. Could someone enlighten me? If I do:
namespace py = boost::python; py::class_< T > outer( "Outer" ); py::scope( outer ); py::class_< U > inner( "Inner" );
then in python:
import module as M print M.Outer.Inner
gives "M.Inner" which doesn't exist. I'm not sure it is important, it just seems curious.
I agree that it's curious, but Python has never really handled inner classes terribly well; Boost.Python's behavior in this respect is the same as pure Python: class Outer(object): class Inner(object): pass print Outer.Inner gives "__main__.Inner" Jim