Hi,

I just implemented C access to the fields of CPython's builtin types like this:

     cdef complex c = 1+2j
     c.real, c.imag = 10, 20
     print (c.real, c.imag)

and then noticed that "real" and "imag" are actually read-only in Python. 
So I wonder if we should disallow the above (i.e. raise a compiler error 
during type analysis) and instead only allow this:

     cdef complex c = 1+2j
     cval = &c.cval
     cval.real, cval.imag = 10, 20
     print (c.real, c.imag)

(which also works now, BTW).

Opinions?

Stefan
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to