Python is faster than C
Jeff Epler
jepler at unpythonic.net
Sun Apr 4 09:48:52 EDT 2004
from pprint import *
def install_hook():
def displayhook(v):
import __main__
if v is not None:
if isiterator(v):
print "<%s object at 0x%8x:" % (
type(v).__name__, id(v)),
v, copy = itertools.tee(v)
for elem in itertools.islice(copy, 3):
print saferepr(elem),
try:
copy.next()
except StopIteration:
pass
else:
print '...',
sys.stdout.softspace=0
print ">"
else:
pprint(v)
__main__._ = v
sys.displayhook = displayhook
Jeff
More information about the Python-list
mailing list