[C++-sig] Inner class name
Jim Bosch
talljimbo at gmail.com
Tue Jun 4 19:45:34 CEST 2013
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
More information about the Cplusplus-sig
mailing list