Index: pep-3141.txt =================================================================== --- pep-3141.txt (revision 64006) +++ pep-3141.txt (working copy) @@ -319,76 +319,52 @@ """__index__() exists because float has __int__().""" return int(self) - @abstractmethod - def __pow__(self, exponent, modulus=None): - """self ** exponent % modulus, but maybe faster. - - Implement this if you want to support the 3-argument - version of pow(). Otherwise, just implement the 2-argument - version described in Complex. If modulus is None, this - should behave as the 2-argument version; otherwise, raise - a TypeError if exponent < 0 or any argument isn't - Integral. - """ - raise NotImplementedError - - @abstractmethod def __lshift__(self, other): - """i<>j returns i // 2**j.""" - raise NotImplementedError + return int(self) >> int(other) - @abstractmethod def __rrshift__(self, other): - raise NotImplementedError + return int(other) >> int(self) - @abstractmethod def __and__(self, other): - raise NotImplementedError + return int(self) & int(other) - @abstractmethod def __rand__(self, other): - raise NotImplementedError + return int(other) & int(self) - @abstractmethod def __xor__(self, other): - raise NotImplementedError + return int(self) ^ int(other) - @abstractmethod def __rxor__(self, other): - raise NotImplementedError + return int(other) ^ int(self) - @abstractmethod def __or__(self, other): - raise NotImplementedError + return int(self) | int(other) - @abstractmethod def __ror__(self, other): - raise NotImplementedError + return int(other) | int(self) - @abstractmethod def __invert__(self): - raise NotImplementedError + return ~int(self) # Concrete implementations of Rational and Real abstract methods. - def __float__(self): + """float(self) == float(int(self))""" return float(int(self)) @property def numerator(self): + """Integers are their own numerators.""" return +self @property def denominator(self): + """Integers have a denominator of 1.""" return 1