[Pyrex] type reading another type's attribute
Greg Ewing
greg at cosc.canterbury.ac.nz
Thu Oct 23 06:10:11 CEST 2003
> cdef class Foo2:
> cdef context2 *ctx2
>
> def __init__(self, foo1):
> self.ctx2 = c_Foo2(foo1.ctx1)
>
>
> it appears that class Foo2 is unable to see the context in Foo1. would
> creating an def _get_context(self) method in class Foo1 be the right
> thing to do?
No, all you need to do is add a declaration:
def __init__(self, Foo1 foo1):
^^^^
Pyrex will then know that foo1 is of type Foo1, and will
be able to see its C attributes.
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Pyrex
mailing list