I commit the change -- I now do

    if D != {}:
        a = D[iter(D).next()]
        if hasattr(a,'parent') and hasattr(a.parent(),'zero'):
            zero = a.parent().zero()
        else:
            zero = 0
    for_removal = [key for key in D if D[key] == zero]
    for key in for_removal:
        del D[key]

Could you please recheck if that solves your problem.

@Nicolas: calling python methods in cython always slows down
everything, that's why I check equality rather that calling is_zero.
Also, your suggestion to construct a new dict at the end, rather than
deleting the keys with values being zero, slows down the process. I
will do some benchmarks in a quite minute...

Best, Christian

On Tue, Jun 7, 2011 at 7:17 AM, Christian Stump
<christian.st...@lacim.ca> wrote:
> Hi,
>
>> The final fix will need discussion. In the mean time, just add a micro
>> patch just before yours to fix dict_addition ``itervalue``.
>
> That was my mistake last week when I changed the code -- sorry!
>
> I will fix that in the next 2 hours and push...
>
> Best, Christian
>



-- 
Christian Stump

LaCIM, Université du Québec à Montréal

christian.st...@lacim.ca
http://homepage.univie.ac.at/christian.stump/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to