#1535: rename __builtin__ module to builtins.

This commit is contained in:
Georg Brandl 2007-12-02 09:40:06 +00:00
parent 87f9c53937
commit 1a3284ed69
70 changed files with 246 additions and 247 deletions

View file

@ -2,7 +2,7 @@
__all__ = ["Repr","repr"]
import __builtin__
import builtins
from itertools import islice
class Repr:
@ -84,16 +84,16 @@ class Repr:
return '{%s}' % (s,)
def repr_str(self, x, level):
s = __builtin__.repr(x[:self.maxstring])
s = builtins.repr(x[:self.maxstring])
if len(s) > self.maxstring:
i = max(0, (self.maxstring-3)//2)
j = max(0, self.maxstring-3-i)
s = __builtin__.repr(x[:i] + x[len(x)-j:])
s = builtins.repr(x[:i] + x[len(x)-j:])
s = s[:i] + '...' + s[len(s)-j:]
return s
def repr_int(self, x, level):
s = __builtin__.repr(x) # XXX Hope this isn't too slow...
s = builtins.repr(x) # XXX Hope this isn't too slow...
if len(s) > self.maxlong:
i = max(0, (self.maxlong-3)//2)
j = max(0, self.maxlong-3-i)
@ -102,7 +102,7 @@ class Repr:
def repr_instance(self, x, level):
try:
s = __builtin__.repr(x)
s = builtins.repr(x)
# Bugs in x.__repr__() can cause arbitrary
# exceptions -- then make up something
except Exception: