From 79d5bdf2b1eaca0f7702fefbe78b60c0ccf14441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 22 Nov 2018 11:44:21 +0100 Subject: [PATCH] py3: some care for libs/ntl --- src/sage/libs/ntl/ntl_GF2X.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pX.pyx | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/sage/libs/ntl/ntl_GF2X.pyx b/src/sage/libs/ntl/ntl_GF2X.pyx index 3b4892a132f..624a8d74f2e 100644 --- a/src/sage/libs/ntl/ntl_GF2X.pyx +++ b/src/sage/libs/ntl/ntl_GF2X.pyx @@ -523,7 +523,7 @@ cdef class ntl_GF2X(object): TESTS:: - sage: hex(e) + sage: hex(e) # py2 doctest:warning...: DeprecationWarning: use the method .hex instead See http://trac.sagemath.org/24514 for details. diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pyx b/src/sage/libs/ntl/ntl_ZZ_pX.pyx index 39bb2bbca6c..df297edb767 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pyx @@ -1,4 +1,4 @@ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2005 William Stein # # Distributed under the terms of the GNU General Public License (GPL) @@ -10,9 +10,8 @@ # # The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ -#***************************************************************************** - +# https://www.gnu.org/licenses/ +# **************************************************************************** from __future__ import absolute_import, division, print_function from cysignals.signals cimport sig_on, sig_off @@ -57,7 +56,7 @@ cdef make_ZZ_pX(ZZ_pX_c* x, ntl_ZZ_pContext_class ctx): cdef class ntl_ZZ_pX(object): r""" - The class \class{ZZ_pX} implements polynomial arithmetic modulo $p$. + The class \class{ZZ_pX} implements polynomial arithmetic modulo `p`. Polynomial arithmetic is implemented using the FFT, combined with the Chinese Remainder Theorem. A more detailed description of the @@ -94,11 +93,10 @@ cdef class ntl_ZZ_pX(object): if isinstance(v, ntl_ZZ_pX) and (v).c is self.c: self.x = (v).x - elif isinstance(v, list) or isinstance(v, tuple): - for i from 0 <= i < len(v): - x = v[i] + elif isinstance(v, (list, tuple, range)): + for i, x in enumerate(v): if not isinstance(x, ntl_ZZ_p): - cc = ntl_ZZ_p(x,self.c) + cc = ntl_ZZ_p(x, self.c) else: cc = x ZZ_pX_SetCoeff(self.x, i, cc.x)