[C++-sig] Nesting classes in boost::python

Hans Meine meine at informatik.uni-hamburg.de
Wed Jun 4 17:31:22 CEST 2008

Hi again,

[note: this is not really about py++!] I wondered why py++ does not properly 
scope the nested classes.  For example, in order to expose a nested class 
Foo::Bar, I use bp::scope in my own code like this:

  scope foo(
      .def ...
  ); // normal class export decl.

    .def ...
} // close scope foo (i.e. "Foo")

The only reason why I could imagine that py++ does not do so is that AFAIK 
this breaks pickling (and possibly more things?), since Foo.Bar.__name__ 
is "Bar" in Python, which does not allow the pickle module to locate the 
class correctly. :-(

This is the reason for the more general subject I chose, because this may 
deserve a discussion and/or fix within the BPL?!

Ciao, /  /
    /  / ANS

More information about the Cplusplus-sig mailing list