construct
construct copied to clipboard
pretty printing long Collections
It would be nice if collections included a way to print them that truncated long sequences. For now, I'm using this:
def trunc(text): ret = [] for l in str(text).splitlines(): if len(l) > 100: l = l[:40] + ' ... ' + l[-40:] ret.append(l)
return "\n".join(ret)
Agreed. I'll see what can be done here.