[Pyrex] self-referencing extension types

Nitin Madnani nmadnani at wam.umd.edu
Wed Sep 21 18:08:55 CEST 2005


I Just realized that I *really* want to do this with extension types  
since i want to return objects of type 'stack' from functions that I  
will write. I can't seem to do that with the way I am set up now (see  
below or my previous post).

Thanks !
Nitin

On Sep 21, 2005, at 12:32 AM, Nitin Madnani wrote:

> Sorry to flood the mailing list with my questions but how do I do  
> something like this in pyrex with extension types:
>
> cdef extern from "foo.h":
>     ctypedef struct stack:
>         long n
>         double f
>         stack* s
>
> def test():
>     cdef stack s1, s2
>     cdef stack* s3
>
>     s1.n = 33
>     s1.f = 4.5
>
>     s2.n = 34
>     s2.f = 5.6
>
>     # They point to each other
>     s1.s = &s2
>     s2.s = &s1
>
>     # See if it worked ..
>     s3 = s1.s
>     print s3.n
>
>
> This does work fine but I was curious if there is an equivalent way  
> to this sort of self-referential thing using extension types.
> Thanks !
> Nitin
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex
>




More information about the Pyrex mailing list