@@ -182,14 +182,23 @@ def exponents(self):
182182
183183 def valuation (self , p = None ):
184184 """
185- Return the valuation of ``self``.
185+ Return the valuation of this polynomial.
186+
187+ INPUT:
188+
189+ - ``p`` -- ``None``, ``infinity`` or a polynomial.
190+ If ``infinity``, returns the negation of the degree of this polynomial.
191+ If a polynomial, returns the largest power of that polynomial dividing this one.
192+ ``None`` gives the same result as the generator.
186193
187194 EXAMPLES::
188195
189196 sage: R.<w> = PolynomialRing(GF(9,'a'), sparse=True)
190197 sage: f = w^1997 - w^10000
191198 sage: f.valuation()
192199 1997
200+ sage: f.valuation(infinity)
201+ -10000
193202 sage: R(19).valuation()
194203 0
195204 sage: R(0).valuation()
@@ -1206,7 +1215,8 @@ def hensel_lift(self, a):
12061215 b = ~ dera
12071216 while (True ):
12081217 na = a - selfa * b
1209- if na == a : return a
1218+ if na == a :
1219+ return a
12101220 a = na
12111221 selfa = self (a )
12121222 dera = der (a )
@@ -1484,7 +1494,8 @@ def _roots(self, secure, minval, hint):
14841494 continue
14851495 if hint is not None and slope == minval :
14861496 rootsbar = hint
1487- if not rootsbar : continue
1497+ if not rootsbar :
1498+ continue
14881499 if i < len (vertices ) - 1 :
14891500 F = P ._factor_of_degree (deg_right - deg )
14901501 P = P // F
@@ -1498,7 +1509,8 @@ def _roots(self, secure, minval, hint):
14981509 if hint is None or slope != minval :
14991510 Fbar = Pk ([ F [j ] >> (val - j * slope ) for j in range (F .degree ()+ 1 ) ])
15001511 rootsbar = [ r for (r , _ ) in Fbar .roots () ]
1501- if not rootsbar : continue
1512+ if not rootsbar :
1513+ continue
15021514 rbar = rootsbar .pop ()
15031515 shift = K (rbar ).lift_to_precision () << slope # probably we should choose a better lift
15041516 roots += [(r + shift , m ) for (r , m ) in F (x + shift )._roots (secure , slope , [r - rbar for r in rootsbar ])] # recursive call
0 commit comments