dealing with objects of 2 classes

Bartosz SKOWRON <[email protected]> Mon, 15 Jun 2009 04:29:37 +0100
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
Hello,

I have a new problem which I cannot find a solution.

Here is a very simple example:

cdef class a:
    cdef foobar_t *foo
    def __init__(self):
           self.foo =3D extern_func1()

cdef class b:
   cdef foobar_t *_foobar
   def __init__(self, obja):
           self._foobar =3D obja.foo

cdef class c:
   def __init__(self, obja):
           self._foobar =3D obja


when i create new object of class b, `b(a())`  i get:
AttributeError: 'a' object has no attribute 'foo'

when i create new object of class c, `c(a())`  i get:
AttributeError: 'c' object has no attribute '_foobar'

In first case, I don't understand what's happen. Do I need extern
somehow 'foo' attribute?

In second, propably I need to declare _foobar first (cdef foobar_t
*_foobar) and prepare some manual conversion. Am I right?

Or this case should be done completely different?

thanks for words,
bart.