[Cython] Assignments in cdefs

Stefan Behnel stefan_ml at behnel.de
Sun Jul 20 20:44:25 CEST 2008


Hi,

Dag Sverre Seljebotn wrote:
> Stefan Behnel wrote:
>> What about code like this:
>>
>>     def test(a):
>>        cdef int c
>>        if a:
>>            c = 1
>>        if not a:
>>            c = 2
>>
>> How would you know what is a "first assignment" here? And what would you gain
>> from your ref-counting optimisation in this case?
> 
> As for the example, it is a "best-effort" thing. If no assignments are 
> flagged as first, then the optimization just doesn't happen, which is 
> the likely outcome of your example.

Then what exactly is your "ref-counting optimisation" doing? Can you give me a
code example?

Stefan



More information about the Cython-dev mailing list