diff --git a/src/sage/categories/crystals.py b/src/sage/categories/crystals.py index 5367ba52083..d44a0daf353 100644 --- a/src/sage/categories/crystals.py +++ b/src/sage/categories/crystals.py @@ -441,12 +441,12 @@ def morphism(b): # - images contains all known morphism(x) # - known contains all elements x for which we know morphism(x) # - todo contains all elements x for which we haven't propagated to each child - while todo <> set( [] ): + while todo != set( [] ): x = todo.pop() for i in index_set: eix = getattr(x, f_string)([i for k in range(similarity_factor_domain[i])]) eigx = getattr(morphism[x], f_string)([automorphism(i) for k in range(similarity_factor[i])]) - if bool(eix is None) <> bool(eigx is None): + if bool(eix is None) != bool(eigx is None): # This is not a crystal morphism! raise ValueError, "This is not a morphism!" #, print("x="x,"g(x)="g(x),"i="i) if (eix is not None) and (eix not in known): diff --git a/src/sage/coding/code_constructions.py b/src/sage/coding/code_constructions.py index bc004135dd5..892c7344500 100644 --- a/src/sage/coding/code_constructions.py +++ b/src/sage/coding/code_constructions.py @@ -221,13 +221,13 @@ def cyclotomic_cosets(q, n, t = None): the cosets are in ZZ/nZZ and 2 = 0 in ZZ/2ZZ. """ from sage.misc.misc import srange - if not(t==None) and type(t)<>Integer: + if t is not None and not isinstance(t, Integer): raise TypeError, "Optional input %s must None or an integer."%t if q<2 or n<2: raise TypeError, "Inputs %s and %s must be > 1."%(q,n) - if GCD(q,n) <> 1: + if GCD(q,n) != 1: raise TypeError, "Inputs %s and %s must be relative prime."%(q,n) - if t<>None and type(t)==Integer: + if t is not None and isinstance(t, Integer): S = Set([t*q**i%n for i in srange(n)]) L = list(S) L.sort() @@ -302,7 +302,7 @@ def is_a_splitting(S1,S2,n): This is a special case of Theorem 6.4.3 in [HP]_. """ - if Set(S1).union(Set(S2)) <> Set(range(1,n)): + if Set(S1).union(Set(S2)) != Set(range(1,n)): raise TypeError, "Lists must partition [1,2,...,n-1]." if n<3: raise TypeError, "Input %s must be > 2."%n diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index e762b669cce..09990c5d356 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -2919,9 +2919,9 @@ def standard_form(self): for i in range(1,k+1): r = M.rows()[i-1] j = r.nonzero_positions()[0] - if (j < d and i <> j+1): + if j < d and i != j+1: perm = perm *G([(i,j+1)]) - if perm <> G([()]): + if perm != G([()]): for i in range(k): r = M.rows()[i] A.append(perm_action(perm,r)) diff --git a/src/sage/combinat/integer_vector.py b/src/sage/combinat/integer_vector.py index 22c4695cb01..7fc5cc90f27 100644 --- a/src/sage/combinat/integer_vector.py +++ b/src/sage/combinat/integer_vector.py @@ -393,7 +393,7 @@ def gale_ryser_theorem(p1, p2, algorithm="gale"): for k in range(1,n+1): goodcols = [i for i in range(n) if s[i]==sum(A0.column(i))] - if sum(A0.column(n-k))<>s[n-k]: + if sum(A0.column(n-k)) != s[n-k]: A0 = _slider01(A0,s[n-k],n-k, p1, p2, goodcols) # If we need to add empty rows/columns diff --git a/src/sage/combinat/sf/monomial.py b/src/sage/combinat/sf/monomial.py index f0a8433dfc2..cf73a5a371a 100644 --- a/src/sage/combinat/sf/monomial.py +++ b/src/sage/combinat/sf/monomial.py @@ -173,7 +173,7 @@ def from_polynomial(self, f, check=True): out = self.sum_of_terms((Partition(e), c) for (e,c) in f.dict().iteritems() if tuple(sorted(e)) == tuple(reversed(e))) - if check and out.expand(f.parent().ngens(),f.parent().gens()) <> f: + if check and out.expand(f.parent().ngens(),f.parent().gens()) != f: raise ValueError, "%s is not a symmetric polynomial"%f return out diff --git a/src/sage/games/hexad.py b/src/sage/games/hexad.py index 81b74c8f7a8..06f94c323f9 100644 --- a/src/sage/games/hexad.py +++ b/src/sage/games/hexad.py @@ -535,29 +535,29 @@ def find_hexad(self, pts): if list(L2)[0] == MINIMOG[2][1]: L1 = LL - L2 H,WHAT = self.find_hexad3(L1,MINIMOG[0][0],MINIMOG[2][1]) - if H <> []: + if H != []: return list(H),WHAT L1 = LL - L2 H,WHAT = self.find_hexad3(L1,MINIMOG[0][2],MINIMOG[2][1]) - if H <> []: + if H != []: return list(H),WHAT if list(L2)[0] == MINIMOG[0][0]: L1 = (LL - L2) H,WHAT = self.find_hexad3(L1,MINIMOG[0][0],MINIMOG[2][1]) - if H <> []: + if H != []: return list(H),WHAT L1 = (LL - L2) H,WHAT = self.find_hexad3(L1,MINIMOG[0][0],MINIMOG[0][2]) - if H <> []: + if H != []: return list(H),WHAT if list(L2)[0] == MINIMOG[0][2]: L1 = (LL - L2) H,WHAT = self.find_hexad3(L1,MINIMOG[0][0],MINIMOG[0][2]) - if H <> []: + if H != []: return list(H),WHAT L1 = (LL - L2) H,WHAT = self.find_hexad3(L1,MINIMOG[2][1],MINIMOG[0][2]) - if H <> []: + if H != []: return list(H),WHAT return list(H),WHAT ## a cross in a pic at infty diff --git a/src/sage/matrix/operation_table.py b/src/sage/matrix/operation_table.py index 49267458511..c1d55fe9db6 100644 --- a/src/sage/matrix/operation_table.py +++ b/src/sage/matrix/operation_table.py @@ -476,7 +476,7 @@ def _name_maker(self, names): sage: T._name_maker(['x']) Traceback (most recent call last): ... - ValueError: list of element names must be the same size as the set, 1 <> 3 + ValueError: list of element names must be the same size as the set, 1 != 3 sage: T._name_maker(['x', 'y', 4]) Traceback (most recent call last): ... @@ -516,7 +516,7 @@ def _name_maker(self, names): name_list.append(estr) elif isinstance(names, list): if len(names) != self._n: - raise ValueError('list of element names must be the same size as the set, %s <> %s'%(len(names), self._n)) + raise ValueError('list of element names must be the same size as the set, %s != %s'%(len(names), self._n)) width = 0 for str in names: if not isinstance(str, basestring): diff --git a/src/sage/quadratic_forms/ternary.pyx b/src/sage/quadratic_forms/ternary.pyx index 14496ebf828..a14e41955bc 100644 --- a/src/sage/quadratic_forms/ternary.pyx +++ b/src/sage/quadratic_forms/ternary.pyx @@ -122,19 +122,19 @@ def _reduced_ternary_form_eisenstein_with_matrix(a1, a2, a3, a23, a13, a12): a23+=a12*m # order 12 - if ((a1>a2) or ((a1==a2) & (abs(a23)>abs(a13)))): + if a1 > a2 or (a1 == a2 and abs(a23) > abs(a13)): M*=matrix(ZZ,3,[0,-1,0,-1,0,0,0,0,-1]) [a1,a2]=[a2,a1] [a13,a23]=[a23,a13] # order 23 - if ((a2>a3) or ((a2==a3) & (abs(a13)>abs(a12)))): + if a2 > a3 or (a2 == a3 and abs(a13) > abs(a12)): M*=matrix(ZZ,3,[-1,0,0,0,0,-1,0,-1,0]) [a2,a3]=[a3,a2] [a13,a12]=[a12,a13] # order 12 - if ((a1>a2) or ((a1==a2) & (abs(a23)>abs(a13)))): + if a1 > a2 or (a1 == a2 and abs(a23) > abs(a13)): M*=matrix(ZZ,3,[0,-1,0,-1,0,0,0,0,-1]) [a1,a2]=[a2,a1] [a13,a23]=[a23,a13] @@ -176,7 +176,7 @@ def _reduced_ternary_form_eisenstein_with_matrix(a1, a2, a3, a23, a13, a12): M*=diagonal_matrix([1,1,-1]) a12=-a12 - loop=(not ((abs(a23)<=a2) & (abs(a13)<=a1) & (abs(a12)<=a1) & (a1+a2+a23+a13+a12>=0))) + loop = not (abs(a23) <= a2 and abs(a13) <= a1 and abs(a12) <= a1 and a1+a2+a23+a13+a12>=0) ################ @@ -185,14 +185,14 @@ def _reduced_ternary_form_eisenstein_with_matrix(a1, a2, a3, a23, a13, a12): # adj 3 - if ((a1+a2+a23+a13+a12==0) & (2*a1+2*a13+a12>0)): + if a1+a2+a23+a13+a12 == 0 and 2*a1+2*a13+a12 > 0: M*=matrix(ZZ,3,[-1,0,1,0,-1,1,0,0,1]) # a3 += a1+a2+a23+a13+a12 a23=-2*a2-a23-a12 a13=-2*a1-a13-a12 # adj 5.12 - if ((a1==-a12) & (a13!=0)): + if a1 == -a12 and a13 != 0: M*=matrix(ZZ,3,[-1,-1,0,0,-1,0,0,0,1]) #a2 += a1+a12 a23=-a23-a13 @@ -200,7 +200,7 @@ def _reduced_ternary_form_eisenstein_with_matrix(a1, a2, a3, a23, a13, a12): a12=-a12 # = 2*a1+a12 # adj 5.13 - if ((a1==-a13) & (a12!=0)): + if a1 == -a13 and a12 != 0: M*=matrix(ZZ,3,[-1,0,-1,0,1,0,0,0,-1]) # a3 += a1+a13 a23=-a23-a12 @@ -208,7 +208,7 @@ def _reduced_ternary_form_eisenstein_with_matrix(a1, a2, a3, a23, a13, a12): a12=-a12 # adj 5.23 - if ((a2==-a23) & (a12!=0)): + if a2 == -a23 and a12 != 0: M*=matrix(ZZ,3,[1,0,0,0,-1,-1,0,0,-1]) # a3 += a2+a23 a23=-a23 # = 2*a2+a23 @@ -216,39 +216,39 @@ def _reduced_ternary_form_eisenstein_with_matrix(a1, a2, a3, a23, a13, a12): a12=-a12 # adj 4.12 - if ((a1==a12) & (a13>2*a23)): + if a1 == a12 and a13 > 2*a23: M*=matrix(ZZ,3,[-1,-1,0,0,1,0,0,0,-1]) # a 2 += a1-a12 a23 = -a23 + a13 # a12 = 2*a1 - a12 # adj 4.13 - if ((a1==a13) & (a12>2*a23)): + if a1 == a13 and a12 > 2*a23: M*=matrix(ZZ,3,[-1,0,-1,0,-1,0,0,0,1]) # a3 += a1-a13 a23 = -a23 + a12 # a13 = 2*a1 - a13 # adj 4.23 - if ((a2==a23) & (a12>2*a13)): + if a2 == a23 and a12 > 2*a13: M*=matrix(ZZ,3,[-1,0,0,0,-1,-1,0,0,1]) # a3 += a2-a23 # a23 = 2*a2 - a23 a13 = -a13 + a12 # order 12 - if (a1==a2) & (abs(a23)>abs(a13)): + if a1 == a2 and abs(a23) > abs(a13): M*=matrix(ZZ,3,[0,-1,0,-1,0,0,0,0,-1]) [a1,a2]=[a2,a1] [a13,a23]=[a23,a13] # order 23 - if (a2==a3) & (abs(a13)>abs(a12)): + if a2 == a3 and abs(a13) > abs(a12): M*=matrix(ZZ,3,[-1,0,0,0,0,-1,0,-1,0]) [a13,a12]=[a12,a13] # order 12 - if (a1==a2) & (abs(a23)>abs(a13)): + if a1 == a2 and abs(a23) > abs(a13): M*=matrix(ZZ,3,[0,-1,0,-1,0,0,0,0,-1]) [a13,a23]=[a23,a13] @@ -309,22 +309,22 @@ def _reduced_ternary_form_eisenstein_without_matrix(a1, a2, a3, a23, a13, a12): a23+=a12*m # order 12 - if ((a1>a2) or ((a1==a2) & (abs(a23)>abs(a13)))): + if a1 > a2 or (a1 == a2 and abs(a23) > abs(a13)): [a1,a2]=[a2,a1] [a13,a23]=[a23,a13] # order 23 - if ((a2>a3) or ((a2==a3) & (abs(a13)>abs(a12)))): + if a2 > a3 or (a2 == a3 and abs(a13) > abs(a12)): [a2,a3]=[a3,a2] [a13,a12]=[a12,a13] # order 12 - if ((a1>a2) or ((a1==a2) & (abs(a23)>abs(a13)))): + if a1 > a2 or (a1 == a2 and abs(a23) > abs(a13)): [a1,a2]=[a2,a1] [a13,a23]=[a23,a13] # signs - if (a23*a13*a12>0): + if a23*a13*a12 > 0: # a23, a13, a12 positive if (a23<0): @@ -354,7 +354,7 @@ def _reduced_ternary_form_eisenstein_without_matrix(a1, a2, a3, a23, a13, a12): if s3: a12=-a12 - loop=(not ((abs(a23)<=a2) & (abs(a13)<=a1) & (abs(a12)<=a1) & (a1+a2+a23+a13+a12>=0))) + loop = not (abs(a23) <= a2 and abs(a13) <= a1 and abs(a12) <= a1 and a1+a2+a23+a13+a12 >= 0) ################ @@ -363,61 +363,61 @@ def _reduced_ternary_form_eisenstein_without_matrix(a1, a2, a3, a23, a13, a12): # adj 3 - if ((a1+a2+a23+a13+a12==0) & (2*a1+2*a13+a12>0)): + if a1+a2+a23+a13+a12 == 0 and 2*a1+2*a13+a12 > 0: # a3 += a1+a2+a23+a13+a12 a23=-2*a2-a23-a12 a13=-2*a1-a13-a12 # adj 5.12 - if ((a1==-a12) & (a13!=0)): + if a1 == -a12 and a13 != 0: #a2 += a1+a12 a23=-a23-a13 a13=-a13 a12=-a12 # = 2*a1+a12 # adj 5.13 - if ((a1==-a13) & (a12!=0)): + if a1 == -a13 and a12 != 0: # a3 += a1+a13 a23=-a23-a12 a13=-a13 # = 2*a1+a13 a12=-a12 # adj 5.23 - if ((a2==-a23) & (a12!=0)): + if a2 == -a23 and a12 != 0: # a3 += a2+a23 a23=-a23 # = 2*a2+a23 a13=-a13-a12 a12=-a12 # adj 4.12 - if ((a1==a12) & (a13>2*a23)): + if a1 == a12 and a13 > 2*a23: # a 2 += a1-a12 a23 = -a23 + a13 # a12 = 2*a1 - a12 # adj 4.13 - if ((a1==a13) & (a12>2*a23)): + if a1 == a13 and a12 > 2*a23: # a3 += a1-a13 a23 = -a23 + a12 # a13 = 2*a1 - a13 # adj 4.23 - if ((a2==a23) & (a12>2*a13)): + if a2 == a23 and a12 > 2*a13: # a3 += a2-a23 # a23 = 2*a2 - a23 a13 = -a13 + a12 # order 12 - if (a1==a2) & (abs(a23)>abs(a13)): + if a1 == a2 and abs(a23) > abs(a13): [a1,a2]=[a2,a1] [a13,a23]=[a23,a13] # order 23 - if (a2==a3) & (abs(a13)>abs(a12)): + if a2 == a3 and abs(a13) > abs(a12): [a13,a12]=[a12,a13] # order 12 - if (a1==a2) & (abs(a23)>abs(a13)): + if a1 == a2 and abs(a23) > abs(a13): [a13,a23]=[a23,a13] return((a1,a2,a3,a23,a13,a12)) @@ -727,44 +727,44 @@ def _find_all_ternary_qf_by_level_disc(long long N, long long d): if (d-r*s*t+a*r*r+b*s*s)%(4*a*b-t**2)==0: c=(d-r*s*t+a*r*r+b*s*s)//(4*a*b-t**2) - if r<=0: - is_reduced=True - if r<-b: - is_reduced=False - elif not ((b<=c) & (0<=a+b+r-s-t)): - is_reduced=False - elif ((a==b) & (abs(r) > abs(s))): - is_reduced=False - elif ((b==c) & (abs(s) > abs(t))): - is_reduced=False - elif ((a+b+r-s-t==0) & (2*a-2*s-t>0)): - is_reduced=False - elif ((a==t) & (s<>0)): - is_reduced=False - elif ((a==s) & (t<>0)): - is_reduced=False - elif ((b==-r) & (t<>0)): - is_reduced=False + if r <= 0: + is_reduced = True + if r < -b: + is_reduced = False + elif not (b <= c and 0 <= a+b+r-s-t): + is_reduced = False + elif a == b and abs(r) > abs(s): + is_reduced = False + elif b == c and abs(s) > abs(t): + is_reduced = False + elif a+b+r-s-t == 0 and 2*a-2*s-t > 0: + is_reduced = False + elif a == t and s != 0: + is_reduced = False + elif a == s and t != 0: + is_reduced = False + elif b == -r and t != 0: + is_reduced = False if is_reduced: m_q=gcd((4*b*c-r**2, 4*a*c-s**2, 4*a*b-t**2, 2*s*t-4*a*r, -2*r*t+4*b*s, -2*r*s+4*c*t)) if m_q==m: l.append((ZZ(a), ZZ(b), ZZ(c), ZZ(r), ZZ(-s), ZZ(-t))) else: is_reduced=True - if not ((b<=c) & (0<=a+b+r+s+t)): - is_reduced=False - elif ((a==b) & (abs(r) > abs(s))): - is_reduced=False - elif ((b==c) & (abs(s) > abs(t))): - is_reduced=False - elif ((a+b+r+s+t==0) & (2*a+2*s+t>0)): - is_reduced=False - elif ((a==t) & (s>2*r)): - is_reduced=False - elif ((a==s) & (t>2*r)): - is_reduced=False - elif ((b==r) & (t>2*s)): - is_reduced=False + if not (b <= c and 0 <= a+b+r+s+t): + is_reduced = False + elif a == b and abs(r) > abs(s): + is_reduced = False + elif b == c and abs(s) > abs(t): + is_reduced = False + elif a+b+r+s+t == 0 and 2*a+2*s+t > 0: + is_reduced = False + elif a == t and s > 2*r: + is_reduced = False + elif a == s and t > 2*r: + is_reduced = False + elif b == r and t > 2*s: + is_reduced = False if is_reduced: m_q=gcd((4*b*c-r**2, 4*a*c-s**2, 4*a*b-t**2, 2*s*t-4*a*r, 2*r*t-4*b*s, 2*r*s-4*c*t)) if m_q==m: @@ -868,44 +868,44 @@ def _find_a_ternary_qf_by_level_disc(long long N, long long d): if (d-r*s*t+a*r*r+b*s*s)%(4*a*b-t**2)==0: c=(d-r*s*t+a*r*r+b*s*s)//(4*a*b-t**2) - if r<=0: - is_reduced=True - if r<-b: - is_reduced=False - elif not ((b<=c) & (0<=a+b+r-s-t)): - is_reduced=False - elif ((a==b) & (abs(r) > abs(s))): - is_reduced=False - elif ((b==c) & (abs(s) > abs(t))): - is_reduced=False - elif ((a+b+r-s-t==0) & (2*a-2*s-t>0)): - is_reduced=False - elif ((a==t) & (s<>0)): - is_reduced=False - elif ((a==s) & (t<>0)): - is_reduced=False - elif ((b==-r) & (t<>0)): - is_reduced=False + if r <= 0: + is_reduced = True + if r < -b: + is_reduced = False + elif not (b <= c and 0 <= a+b+r-s-t): + is_reduced = False + elif a == b and abs(r) > abs(s): + is_reduced = False + elif b == c and abs(s) > abs(t): + is_reduced = False + elif a+b+r-s-t == 0 and 2*a-2*s-t > 0: + is_reduced = False + elif a == t and s != 0: + is_reduced = False + elif a == s and t != 0: + is_reduced = False + elif b == -r and t != 0: + is_reduced = False if is_reduced: m_q=gcd((4*b*c-r**2, 4*a*c-s**2, 4*a*b-t**2, 2*s*t-4*a*r, -2*r*t+4*b*s, -2*r*s+4*c*t)) if m_q==m: return ZZ(a), ZZ(b), ZZ(c), ZZ(r), ZZ(-s), ZZ(-t) else: - is_reduced=True - if not ((b<=c) & (0<=a+b+r+s+t)): - is_reduced=False - elif ((a==b) & (abs(r) > abs(s))): - is_reduced=False - elif ((b==c) & (abs(s) > abs(t))): - is_reduced=False - elif ((a+b+r+s+t==0) & (2*a+2*s+t>0)): - is_reduced=False - elif ((a==t) & (s>2*r)): - is_reduced=False - elif ((a==s) & (t>2*r)): - is_reduced=False - elif ((b==r) & (t>2*s)): - is_reduced=False + is_reduced = True + if not (b <= c and 0 <= a+b+r+s+t): + is_reduced = False + elif a == b and abs(r) > abs(s): + is_reduced = False + elif b == c and abs(s) > abs(t): + is_reduced = False + elif a+b+r+s+t == 0 and 2*a+2*s+t > 0: + is_reduced = False + elif a==t and s > 2*r: + is_reduced = False + elif a == s and t>2*r: + is_reduced = False + elif b == r and t > 2*s: + is_reduced = False if is_reduced: m_q=gcd((4*b*c-r**2, 4*a*c-s**2, 4*a*b-t**2, 2*s*t-4*a*r, 2*r*t-4*b*s, 2*r*s-4*c*t)) if m_q==m: diff --git a/src/sage/quadratic_forms/ternary_qf.py b/src/sage/quadratic_forms/ternary_qf.py index 003309759d1..9548e646aae 100644 --- a/src/sage/quadratic_forms/ternary_qf.py +++ b/src/sage/quadratic_forms/ternary_qf.py @@ -760,43 +760,43 @@ def is_eisenstein_reduced(self): [a,b,c,r,s,t]=[self._a,self._b,self._c,self._r,self._s,self._t] # cond 2 - if not ((r>0) & (t>0) & (s>0)): - if not ((r<=0) & (s<=0) & (t<=0)): + if not (r > 0 and t > 0 and s > 0): + if not (r <= 0 and s <= 0 and t <= 0): return False # cond 1 & 4 - if not ((a<=b<=c) & (0<=a+b+r+s+t)): + if not (a <= b <= c and 0 <= a+b+r+s+t): return False # cond 3 - if not ((a>=abs(s)) & (a>=abs(t)) & (b>=abs(r))): + if not (a >= abs(s) and a >= abs(t) and b >= abs(r)): return False # cond 8 - if ((a==b) & (abs(r)>abs(s))): + if a == b and abs(r) > abs(s): return False - if ((b==c) & (abs(s)>abs(t))): + if b == c and abs(s) > abs(t): return False - if ((a+b+r+s+t==0) & (2*a+2*s+t>0)): + if a+b+r+s+t == 0 and 2*a+2*s+t > 0: return False # cond 6 # r, s, t <= 0 if r<=0: - if ((a==-t) & (s<>0)): + if a == -t and s != 0: return False - if ((a==-s) & (t<>0)): + if a == -s and t != 0: return False - if ((b==-r) & (t<>0)): + if b == -r and t != 0: return False # cond 7 # r, s, t > 0 - if ((a==t) & (s>2*r)): + if a == t and s > 2*r: return False - if ((a==s) & (t>2*r)): + if a == s and t > 2*r: return False - if ((b==r) & (t>2*s)): + if b == r and t > 2*s: return False return True @@ -1477,7 +1477,7 @@ def _automorphisms_reduced_fast(self): (-1, 0, 0, 0, 1, -1, 0, 0, -1)] if self._border(7): - if self._border(8) & self._border(15): + if self._border(8) and self._border(15): if self._border(16): if self._border(9): # borders 7, 8, 9, 15, 16 @@ -1537,7 +1537,7 @@ def _automorphisms_reduced_fast(self): if self._border(8): if self._border(9): - if self._border(10) & self._border(11) & self._border(12): + if self._border(10) and self._border(11) and self._border(12): # borders 8, 9, 10, 11, 12 return [(1, 0, 0, 0, 1, 0, 0, 0, 1), (-1, 0, 0, 0, -1, 0, 0, 0, 1), @@ -1563,7 +1563,7 @@ def _automorphisms_reduced_fast(self): (1, 0, 0, 0, -1, 0, 0, 0, -1), (1, 0, 0, 0, 0, -1, 0, 1, 0), (1, 0, 0, 0, 0, 1, 0, -1, 0)] - elif self._border(13) & self._border(14): + elif self._border(13) and self._border(14): # borders 8, 9, 13, 14 return [(1, 0, 0, 0, 1, 0, 0, 0, 1), (-1, -1, -1, 0, 0, 1, 0, 1, 0), @@ -1598,7 +1598,7 @@ def _automorphisms_reduced_fast(self): (0, 0, 1, 1, 0, 0, 0, 1, 0), (0, 1, 0, 0, 0, 1, 1, 0, 0)] elif self._border(10): - if self._border(11) & self._border(12): + if self._border(11) and self._border(12): # borders 8, 10, 11, 12 return [(1, 0, 0, 0, 1, 0, 0, 0, 1), (-1, 0, 0, 0, -1, 0, 0, 0, 1), @@ -1629,7 +1629,7 @@ def _automorphisms_reduced_fast(self): if self._border(9): if self._border(12): - if self._border(10) & self._border(11): + if self._border(10) and self._border(11): # borders 9, 10, 11, 12 return [(1, 0, 0, 0, 1, 0, 0, 0, 1), (-1, 0, 0, 0, -1, 0, 0, 0, 1), @@ -1674,7 +1674,7 @@ def _automorphisms_reduced_fast(self): (-1, 0, 0, 0, 0, -1, 0, -1, 0)] if self._border(10): - if self._border(11) & self._border(12): + if self._border(11) and self._border(12): # borders 10, 11, 12 return [(1, 0, 0, 0, 1, 0, 0, 0, 1), (-1, 0, 0, 0, -1, 0, 0, 0, 1), @@ -1695,7 +1695,7 @@ def _automorphisms_reduced_fast(self): return [(1, 0, 0, 0, 1, 0, 0, 0, 1), (1, 0, 0, 0, -1, 0, 0, 0, -1)] - if self._border(13) & self._border(14): + if self._border(13) and self._border(14): # border 13, 14 return [(1, 0, 0, 0, 1, 0, 0, 0, 1), (1, 1, 1, 0, -1, 0, 0, 0, -1)] @@ -1912,7 +1912,7 @@ def _number_of_automorphisms_reduced(self): return 2 if self._border(7): - if self._border(8) & self._border(15): + if self._border(8) and self._border(15): if self._border(16): if self._border(9): # borders 7, 8, 9, 15, 16 @@ -1933,17 +1933,17 @@ def _number_of_automorphisms_reduced(self): if self._border(8): if self._border(9): - if self._border(10) & self._border(11) & self._border(12): + if self._border(10) and self._border(11) and self._border(12): # borders 8, 9, 10, 11, 12 return 24 - elif self._border(13) & self._border(14): + elif self._border(13) and self._border(14): # borders 8, 9, 13, 14 return 24 else: # borders 8, 9 return 6 elif self._border(10): - if self._border(11) & self._border(12): + if self._border(11) and self._border(12): # borders 8, 10, 11, 12 return 8 else: @@ -1958,7 +1958,7 @@ def _number_of_automorphisms_reduced(self): if self._border(9): if self._border(12): - if self._border(10) & self._border(11): + if self._border(10) and self._border(11): # borders 9, 10, 11, 12 return 8 else: @@ -1979,7 +1979,7 @@ def _number_of_automorphisms_reduced(self): return 2 if self._border(10): - if self._border(11) & self._border(12): + if self._border(11) and self._border(12): # borders 10, 11, 12 return 4 else: @@ -1994,7 +1994,7 @@ def _number_of_automorphisms_reduced(self): # border 12 return 2 - if self._border(13) & self._border(14): + if self._border(13) and self._border(14): # border 13, 14 return 2 diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index e405368a5ed..7150ebd99ad 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -1269,7 +1269,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): sage: C200(1+i).is_real() False """ - return (mpfr_zero_p(self.value.im) <> 0) + return (mpfr_zero_p(self.value.im) != 0) def is_imaginary(self): """ @@ -1283,7 +1283,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): sage: C200(1+i).is_imaginary() False """ - return (mpfr_zero_p(self.value.re) <> 0) + return (mpfr_zero_p(self.value.re) != 0) def algebraic_dependency(self, n, **kwds): """ diff --git a/src/sage/rings/complex_number.pyx b/src/sage/rings/complex_number.pyx index 9f0a97cf666..5fb02097125 100644 --- a/src/sage/rings/complex_number.pyx +++ b/src/sage/rings/complex_number.pyx @@ -2249,7 +2249,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): sage: CC(1+i).is_real() False """ - return (mpfr_zero_p(self.__im) <> 0) + return (mpfr_zero_p(self.__im) != 0) def is_imaginary(self): """ @@ -2262,7 +2262,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): sage: CC(1+i).is_imaginary() False """ - return (mpfr_zero_p(self.__re) <> 0) + return (mpfr_zero_p(self.__re) != 0) def zeta(self): """ diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index a0663314a2c..8c34becd67a 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -821,7 +821,7 @@ def is_prime(self): ass = self.associated_primes() except (NotImplementedError, ValueError): raise NotImplementedError - if len(ass) <> 1: + if len(ass) != 1: return False if self == ass[0]: return True diff --git a/src/sage/rings/number_field/totallyreal_data.pyx b/src/sage/rings/number_field/totallyreal_data.pyx index 216727bd69e..0804309e7bb 100644 --- a/src/sage/rings/number_field/totallyreal_data.pyx +++ b/src/sage/rings/number_field/totallyreal_data.pyx @@ -525,7 +525,7 @@ cdef class tr_data: # The value of k is the largest index of the coefficients of a which is # currently unknown; e.g., if k == -1, then we can iterate # over polynomials, and if k == n-1, then we have finished iterating. - if a[len(a)-1] <> 1: + if a[len(a)-1] != 1: raise ValueError, "a[len(a)-1](=%s) must be 1 so polynomial is monic"%a[len(a)-1] k = n-len(a) @@ -774,7 +774,7 @@ cdef class tr_data: f = ZZx([self.gnk[(k+1)*n+i] for i in range(n-(k+1)+1)]) # Could just take self.gnk(k+2)*n+i, but this may not be initialized... df = ZZx([i*self.gnk[(k+1)*n+i] for i in range(1,n-(k+1)+1)]) - if gcd(f,df) <> 1: + if gcd(f,df) != 1: if verbose: print " gnk has multiple factor!" maxoutflag = 1 diff --git a/src/sage/rings/number_field/totallyreal_phc.py b/src/sage/rings/number_field/totallyreal_phc.py index bbfa53a30d1..82c5d5c30e5 100644 --- a/src/sage/rings/number_field/totallyreal_phc.py +++ b/src/sage/rings/number_field/totallyreal_phc.py @@ -138,7 +138,7 @@ def __lagrange_bounds_phc(n, m, a, tmpfile=None): f_str = f.read() pos = f_str.find('= real ') crits = [] - while pos <> -1: + while pos != -1: posl = f_str.rfind('xn', 0, pos) f_str_split = f_str[posl:pos].split() crits += [float(f_str_split[2])] diff --git a/src/sage/rings/number_field/totallyreal_rel.py b/src/sage/rings/number_field/totallyreal_rel.py index c5d5993d20a..0956c8482e8 100644 --- a/src/sage/rings/number_field/totallyreal_rel.py +++ b/src/sage/rings/number_field/totallyreal_rel.py @@ -311,7 +311,7 @@ def __init__(self, F, m, B, a=None): # The value of k is the largest index of the coefficients of a which is # currently unknown; e.g., if k == -1, then we can iterate # over polynomials, and if k == n-1, then we have finished iterating. - if a[len(a)-1] <> 1: + if a[len(a)-1] != 1: raise ValueError, "a[len(a)-1](=%s) must be 1 so polynomial is monic"%a[len(a)-1] raise NotImplementedError, "These have not been checked." @@ -518,7 +518,7 @@ def incr(self, f_out, verbose=False, haltk=0): # the Python routine should be sufficiently fast... f = self.Fx(self.gnk[k+1]) df = self.Fx(self.gnk[k+2]) - if gcd(f,df) <> 1: + if gcd(f,df) != 1: if verbose: print " gnk has multiple factor!" maxoutflag = True @@ -725,7 +725,7 @@ def enumerate_totallyreal_fields_rel(F, m, B, a = [], verbose=0, return_seqs=Fal nfF = pari(str(F.defining_polynomial()).replace('x', str(F.primitive_element()) ) ) parit = pari(str(F.primitive_element())) - while f_out[m] <> 0: + while f_out[m] != 0: counts[0] += 1 if verbose: print "==>", f_out, diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py index a3c57698782..707630e5b49 100644 --- a/src/sage/symbolic/relation.py +++ b/src/sage/symbolic/relation.py @@ -382,8 +382,6 @@ def test_relation_maxima(relation): True sage: test_relation_maxima(x!=1) False - sage: test_relation_maxima(x<>1) # alternate syntax for not equal - False sage: forget() sage: assume(x>0) sage: test_relation_maxima(x==0) diff --git a/src/sage/tests/french_book/float_doctest.py b/src/sage/tests/french_book/float_doctest.py index 666542c541f..b4d6afa4c6b 100644 --- a/src/sage/tests/french_book/float_doctest.py +++ b/src/sage/tests/french_book/float_doctest.py @@ -174,7 +174,7 @@ sage: def sumharmo(P): ....: RFP = RealField(P) ....: y = RFP(1.); x = RFP(0.); n = 1 - ....: while x <> y: + ....: while x != y: ....: y = x; x += 1/n; n += 1 ....: return P, n, x diff --git a/src/sage/tests/french_book/programmation_doctest.py b/src/sage/tests/french_book/programmation_doctest.py index bb35e606904..ccb96770210 100644 --- a/src/sage/tests/french_book/programmation_doctest.py +++ b/src/sage/tests/french_book/programmation_doctest.py @@ -132,7 +132,7 @@ Sage example in ./programmation.tex, line 807:: sage: u = 6 ; n = 0 - sage: while u != 1: # test "différent de" <> aussi possible + sage: while u != 1: # test "différent de" ....: if u % 2 == 0: # l'opérateur % donne le reste euclidien ....: u = u//2 # // : quotient de la division euclidienne ....: else: