Re: [pygccxml-development] Parameter passing, ownership semantics
Brought to you by:
mbaas,
roman_yakovenko
|
From: Gustavo C. <gjc...@gm...> - 2007-02-20 11:34:46
|
On 2/20/07, Roman Yakovenko <rom...@gm...> wrote:
>
> On 2/20/07, Gustavo Carneiro <gjc...@gm...> wrote:
> >
> > On 2/19/07, Roman Yakovenko <rom...@gm... > wrote:
> > >
> > > Hi. Unfortunately I reproduced the error and was not able to fix it
> > > :-(((((.
> >
> >
> > Hey, thanks a lot anyway; it is now a problem in boost, but you solved
> > the Py++ part of the problem with commendable speed.
> >
> > There is something I don't understand and I think this is
> > > Boost.Python bug.
> > >
> > > I do made some progress.
> > >
> > > 1. When you derive Python class from a C++ one you have to define
> > > __init__
> > > method, otherwise your code will not work:
> >
> >
> > Since when does a subclass have to define __init__ in order to get the
> > parent class __init__ called? What you say goes against all my python
> > knowledge...
> >
>
> During __init__ method of parent class reference to relevant Python object
> is
> saved and associated with the C++ class.
>
But if I don't define __init__ in a subclass, the parent class __init__ is
automatically used instead, as demonstrated by this example:
class Foo(object):
def __init__(self):
print "Foo.__init__"
class Bar(Foo):
pass
bar = Bar()
I think the problem you want to express is when Bar defines __init__ but
doesn't chain to the parent class __init__.
--
Gustavo J. A. M. Carneiro
"The universe is always one step beyond logic."
|