[Pyrex] c-code mis-interpretation

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Dec 19 01:54:30 UTC 2006


Joel B. Mohler wrote:
> def unlist():
>         lst = [1,2]
>         lst,m = lst
> 
> the variable "lst" is bound to the first element 
> of the list (the integer 1) before the second element is extracted 
> from "lst".

Hmmm, this isn't so much a case of incorrect C code as
a semantic difference between Python and Pyrex. Python
nowadays uses the iterator protocol to unpack the RHS,
whereas currently Pyrex uses direct indexing.

I'm planning to change Pyrex so that it uses iteration
as well, which should make this problem go away.

In the meantime, the obvious workaround is to unpack
into some other variable and then assign it to lst.

 > If there is a better place to
> report this, let me know.

No, this is the right place for now.

Thanks,
Greg




More information about the Pyrex mailing list