1.1 --- a/lib/builtins.py Fri Jan 26 00:05:20 2007 +0100
1.2 +++ b/lib/builtins.py Fri Jan 26 01:26:28 2007 +0100
1.3 @@ -218,7 +218,7 @@
1.4 elif isinstance(other, float):
1.5 return bool()
1.6 else:
1.7 - raise TypeError
1.8 + return NotImplemented
1.9
1.10 def __gt__(self, other):
1.11 if isinstance(other, int):
1.12 @@ -228,7 +228,7 @@
1.13 elif isinstance(other, float):
1.14 return bool()
1.15 else:
1.16 - raise TypeError
1.17 + return NotImplemented
1.18
1.19 def __le__(self, other):
1.20 if isinstance(other, int):
1.21 @@ -238,7 +238,7 @@
1.22 elif isinstance(other, float):
1.23 return bool()
1.24 else:
1.25 - raise TypeError
1.26 + return NotImplemented
1.27
1.28 def __ge__(self, other):
1.29 if isinstance(other, int):
1.30 @@ -248,7 +248,7 @@
1.31 elif isinstance(other, float):
1.32 return bool()
1.33 else:
1.34 - raise TypeError
1.35 + return NotImplemented
1.36
1.37 def __eq__(self, other):
1.38 if isinstance(other, int):
1.39 @@ -258,7 +258,7 @@
1.40 elif isinstance(other, float):
1.41 return bool()
1.42 else:
1.43 - raise TypeError
1.44 + return NotImplemented
1.45
1.46 def __ne__(self, other):
1.47 if isinstance(other, int):
1.48 @@ -268,7 +268,7 @@
1.49 elif isinstance(other, float):
1.50 return bool()
1.51 else:
1.52 - raise TypeError
1.53 + return NotImplemented
1.54
1.55 def __neg__(self):
1.56 return float()
1.57 @@ -365,37 +365,37 @@
1.58 if isinstance(other, int):
1.59 return bool()
1.60 else:
1.61 - raise TypeError
1.62 + return NotImplemented
1.63
1.64 def __gt__(self, other):
1.65 if isinstance(other, int):
1.66 return bool()
1.67 else:
1.68 - raise TypeError
1.69 + return NotImplemented
1.70
1.71 def __le__(self, other):
1.72 if isinstance(other, int):
1.73 return bool()
1.74 else:
1.75 - raise TypeError
1.76 + return NotImplemented
1.77
1.78 def __ge__(self, other):
1.79 if isinstance(other, int):
1.80 return bool()
1.81 else:
1.82 - raise TypeError
1.83 + return NotImplemented
1.84
1.85 def __eq__(self, other):
1.86 if isinstance(other, int):
1.87 return bool()
1.88 else:
1.89 - raise TypeError
1.90 + return NotImplemented
1.91
1.92 def __ne__(self, other):
1.93 if isinstance(other, int):
1.94 return bool()
1.95 else:
1.96 - raise TypeError
1.97 + return NotImplemented
1.98
1.99 def __neg__(self):
1.100 return int()
1.101 @@ -531,7 +531,7 @@
1.102 elif isinstance(other, long):
1.103 return bool()
1.104 else:
1.105 - raise TypeError
1.106 + return NotImplemented
1.107
1.108 def __gt__(self, other):
1.109 if isinstance(other, int):
1.110 @@ -539,7 +539,7 @@
1.111 elif isinstance(other, long):
1.112 return bool()
1.113 else:
1.114 - raise TypeError
1.115 + return NotImplemented
1.116
1.117 def __le__(self, other):
1.118 if isinstance(other, int):
1.119 @@ -547,7 +547,7 @@
1.120 elif isinstance(other, long):
1.121 return bool()
1.122 else:
1.123 - raise TypeError
1.124 + return NotImplemented
1.125
1.126 def __ge__(self, other):
1.127 if isinstance(other, int):
1.128 @@ -555,7 +555,7 @@
1.129 elif isinstance(other, long):
1.130 return bool()
1.131 else:
1.132 - raise TypeError
1.133 + return NotImplemented
1.134
1.135 def __eq__(self, other):
1.136 if isinstance(other, int):
1.137 @@ -563,7 +563,7 @@
1.138 elif isinstance(other, long):
1.139 return bool()
1.140 else:
1.141 - raise TypeError
1.142 + return NotImplemented
1.143
1.144 def __ne__(self, other):
1.145 if isinstance(other, int):
1.146 @@ -571,7 +571,7 @@
1.147 elif isinstance(other, long):
1.148 return bool()
1.149 else:
1.150 - raise TypeError
1.151 + return NotImplemented
1.152
1.153 def __neg__(self):
1.154 return long()
1.155 @@ -736,6 +736,9 @@
1.156 class TypeError(Exception):
1.157 pass
1.158
1.159 +class NotImplementedType:
1.160 + pass
1.161 +
1.162 # General functions.
1.163
1.164 def isinstance(obj, cls):
1.165 @@ -782,6 +785,7 @@
1.166 stdin = file()
1.167 stdout = file()
1.168 stderr = file()
1.169 +NotImplemented = NotImplementedType()
1.170
1.171 # Special functions. These all operate on references at run-time.
1.172