[C++-sig] python namespace
Bjorn Pettersen
BPettersen at NAREX.com
Thu Nov 21 23:34:48 CET 2002
> From: David Abrahams [mailto:dave at boost-consulting.com]
>
> "Achim Domma" <achim.domma at syynx.de> writes:
>
> > Hi,
> >
> > I have the same problem like Francois. I use the following:
> >
> > handle<> inner_module(PyModule_New("Drawable"));
> > scope().attr("Drawable") = inner_module;
> > scope drawable = object(inner_module);
> >
> > it works fine with VC7 but I tried it on RH8 with gcc3.2 and it
failed
> > to compile with the same error as Francois code. Then I tried
> > something like:
> >
> > scope drawable = scope(object(inner_module))
>
> Why are you messing around with that approach when I already
> posted this correct one?
>
> scope drawable(object(inner_module));
Now I'm confused... If I use the following code:
handle<> db_module(PyModule_New("db"));
scope().attr("db") = db_module;
scope db_scope = object(db_module); /**/
class_<X>("X");
X ends up in nrx.db (my main module is named nrx) and everything works
as expected. If I change the line marked /**/ to:
scope db_scope(object(db_module));
X ends up in nrx and there's an empty nrx.db. To add to the confusion, I
thought:
A a = B(x);
was equivalent to:
A a(B(x));
is my C++ really that rusty?
-- bjorn
(running XP/VC6)
More information about the Cplusplus-sig
mailing list