[Pyrex] dealing with objects of 2 classes

Bartosz SKOWRON getxsick at gmail.com
Mon Jun 15 07:37:18 CEST 2009


On Mon, Jun 15, 2009 at 5:23 AM, Stefan Behnel<stefan_ml at behnel.de> wrote:

>> 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'
>
> You have to declare the variables that you assign the objects to, as in
>
>        cdef b some_b
>        some_b = b(a())
>        print some_b.foo.some_struct_member

but that b(a()) I would like to do from the Python interpreter, not in Pyrex.



More information about the Pyrex mailing list