1.1 --- a/lib/builtins.py Tue Jun 19 01:39:05 2007 +0200
1.2 +++ b/lib/builtins.py Thu Jun 21 01:24:10 2007 +0200
1.3 @@ -197,6 +197,16 @@
1.4 else:
1.5 raise TypeError
1.6
1.7 + def __mod__(self, other):
1.8 + if isinstance(other, int):
1.9 + return float()
1.10 + elif isinstance(other, long):
1.11 + return float()
1.12 + elif isinstance(other, float):
1.13 + return float()
1.14 + else:
1.15 + raise TypeError
1.16 +
1.17 def __pow__(self, other):
1.18 if isinstance(other, int):
1.19 return float()
1.20 @@ -367,6 +377,12 @@
1.21 else:
1.22 raise TypeError
1.23
1.24 + def __mod__(self, other):
1.25 + if isinstance(other, int):
1.26 + return int()
1.27 + else:
1.28 + raise TypeError
1.29 +
1.30 def __pow__(self, other):
1.31 if isinstance(other, int):
1.32 return int()
1.33 @@ -577,6 +593,54 @@
1.34 else:
1.35 raise TypeError
1.36
1.37 + def __mul__(self, other):
1.38 + if isinstance(other, int):
1.39 + return long()
1.40 + elif isinstance(other, long):
1.41 + return long()
1.42 + else:
1.43 + raise TypeError
1.44 +
1.45 + def __rmul__(self, other):
1.46 + if isinstance(other, int):
1.47 + return long()
1.48 + elif isinstance(other, long):
1.49 + return long()
1.50 + else:
1.51 + raise TypeError
1.52 +
1.53 + def __div__(self, other):
1.54 + if isinstance(other, int):
1.55 + return long()
1.56 + elif isinstance(other, long):
1.57 + return long()
1.58 + else:
1.59 + raise TypeError
1.60 +
1.61 + def __rdiv__(self, other):
1.62 + if isinstance(other, int):
1.63 + return long()
1.64 + elif isinstance(other, long):
1.65 + return long()
1.66 + else:
1.67 + raise TypeError
1.68 +
1.69 + def __floordiv__(self, other):
1.70 + if isinstance(other, int):
1.71 + return long()
1.72 + elif isinstance(other, long):
1.73 + return long()
1.74 + else:
1.75 + raise TypeError
1.76 +
1.77 + def __rfloordiv__(self, other):
1.78 + if isinstance(other, int):
1.79 + return long()
1.80 + elif isinstance(other, long):
1.81 + return long()
1.82 + else:
1.83 + raise TypeError
1.84 +
1.85 def __and__(self, other):
1.86 if isinstance(other, int):
1.87 return long()
1.88 @@ -710,6 +774,12 @@
1.89 def __init__(self, x=None):
1.90 x.__str__()
1.91
1.92 + def __iadd__(self, other):
1.93 + if isinstance(other, str):
1.94 + return str()
1.95 + else:
1.96 + raise TypeError
1.97 +
1.98 def __add__(self, other):
1.99 if isinstance(other, str):
1.100 return str()
1.101 @@ -722,6 +792,18 @@
1.102 else:
1.103 raise TypeError
1.104
1.105 + def __mul__(self, other):
1.106 + if isinstance(other, int) or isinstance(other, long):
1.107 + return str()
1.108 + else:
1.109 + raise TypeError
1.110 +
1.111 + def __radd__(self, other):
1.112 + if isinstance(other, int) or isinstance(other, long):
1.113 + return str()
1.114 + else:
1.115 + raise TypeError
1.116 +
1.117 def __mod__(self, other):
1.118
1.119 "The format operator for strings."