Opened 3 years ago

Closed 3 years ago

#22530 closed enhancement (duplicate)

Revert six.iteritems in laurent_polynomial.pyx

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: cython Keywords:
Cc: dkrenn Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: u/jdemeyer/revert_six_iteritems_in_laurent_polynomial_pyx (Commits) Commit: 1fc5c7b3c3e9d2f5380904f5191d73672888a94a
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

Revert

  • src/sage/rings/polynomial/laurent_polynomial.pyx

    commit 92699fd23f29568077c577b65a1c561b7415269a
    Author: Daniel Krenn <git@danielkrenn.at>
    Date:   Thu Nov 10 14:40:28 2016 +0100
    
        Python3-ify (iteritems)
    
    diff --git a/src/sage/rings/polynomial/laurent_polynomial.pyx b/src/sage/rings/polynomial/laurent_polynomial.pyx
    index fa61705..e6db620 100644
    a b Elements of Laurent polynomial rings 
    1010#                  http://www.gnu.org/licenses/
    1111#*****************************************************************************
    1212from __future__ import print_function
     13from six import iterkeys, iteritems
    1314
    1415from sage.rings.integer cimport Integer
    1516from sage.structure.element import is_Element, coerce_binop
    cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): 
    24822483        except ValueError:
    24832484            # call _derivative() recursively on coefficients
    24842485            return P({m: c._derivative(var)
    2485                       for (m, c) in self.dict().iteritems()})
     2486                      for (m, c) in iteritems(self.dict())})
    24862487
    24872488        # compute formal derivative with respect to generator
    24882489        d = {}
    2489         for m, c in self.dict().iteritems():
     2490        for m, c in iteritems(self.dict()):
    24902491            if m[index] != 0:
    24912492                new_m = [u for u in m]
    24922493                new_m[index] += -1

Cython understands dict.iteritems() and actually optimizes it (unlike six.iteritems)

Change History (5)

comment:1 Changed 3 years ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 3 years ago by jdemeyer

  • Branch set to u/jdemeyer/revert_six_iteritems_in_laurent_polynomial_pyx

comment:3 Changed 3 years ago by jdemeyer

  • Commit set to 1fc5c7b3c3e9d2f5380904f5191d73672888a94a
  • Status changed from new to needs_review

New commits:

1fc5c7bRevert "Python3-ify (iteritems)"

comment:4 Changed 3 years ago by chapoton

see #22515

comment:5 Changed 3 years ago by jdemeyer

  • Authors Jeroen Demeyer deleted
  • Milestone changed from sage-7.6 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Reviewers set to Jeroen Demeyer
  • Status changed from needs_review to closed
Note: See TracTickets for help on using tickets.