@@ -1135,10 +1135,9 @@ def __mul__(self, other, context=None):
11351135 return ans
11361136 __rmul__ = __mul__
11371137
1138- def __div__ (self , other , context = None ):
1138+ def __truediv__ (self , other , context = None ):
11391139 """Return self / other."""
11401140 return self ._divide (other , context = context )
1141- __truediv__ = __div__
11421141
11431142 def _divide (self , other , divmod = 0 , context = None ):
11441143 """Return a / b, to context.prec precision.
@@ -1306,13 +1305,12 @@ def _divide(self, other, divmod = 0, context=None):
13061305 ans = ans ._fix (context )
13071306 return ans
13081307
1309- def __rdiv__ (self , other , context = None ):
1310- """Swaps self/other and returns __div__ ."""
1308+ def __rtruediv__ (self , other , context = None ):
1309+ """Swaps self/other and returns __truediv__ ."""
13111310 other = _convert_other (other )
13121311 if other is NotImplemented :
13131312 return other
1314- return other .__div__ (self , context = context )
1315- __rtruediv__ = __rdiv__
1313+ return other .__truediv__ (self , context = context )
13161314
13171315 def __divmod__ (self , other , context = None ):
13181316 """
@@ -1384,9 +1382,9 @@ def remainder_near(self, other, context=None):
13841382 rounding = context ._set_rounding_decision (NEVER_ROUND )
13851383
13861384 if other ._sign :
1387- comparison = other .__div__ (Decimal (- 2 ), context = context )
1385+ comparison = other .__truediv__ (Decimal (- 2 ), context = context )
13881386 else :
1389- comparison = other .__div__ (Decimal (2 ), context = context )
1387+ comparison = other .__truediv__ (Decimal (2 ), context = context )
13901388
13911389 context ._set_rounding_decision (rounding )
13921390 context ._regard_flags (* flags )
@@ -1751,7 +1749,7 @@ def __pow__(self, n, modulo = None, context=None):
17511749 if n < 0 :
17521750 #n is a long now, not Decimal instance
17531751 n = - n
1754- mul = Decimal (1 ).__div__ (mul , context = context )
1752+ mul = Decimal (1 ).__truediv__ (mul , context = context )
17551753
17561754 spot = 1
17571755 while spot <= n :
@@ -1972,7 +1970,7 @@ def sqrt(self, context=None):
19721970 rounding = context ._set_rounding (ROUND_HALF_EVEN )
19731971 while 1 :
19741972 context .prec = min (2 * context .prec - 2 , maxp )
1975- ans = half .__mul__ (ans .__add__ (tmp .__div__ (ans , context = context ),
1973+ ans = half .__mul__ (ans .__add__ (tmp .__truediv__ (ans , context = context ),
19761974 context = context ), context = context )
19771975 if context .prec == maxp :
19781976 break
@@ -2454,7 +2452,7 @@ def divide(self, a, b):
24542452 >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2'))
24552453 Decimal("1.20E+6")
24562454 """
2457- return a .__div__ (b , context = self )
2455+ return a .__truediv__ (b , context = self )
24582456
24592457 def divide_int (self , a , b ):
24602458 """Divides two numbers and returns the integer part of the result.
0 commit comments