[IPython-User] Pretty print as default print function
Fri Nov 16 04:53:17 CST 2012
On 10 November 2012 08:34, Carl Smith <email@example.com> wrote:
> Can you not redirect stdout to a method with something like...
> class StandardOut(object):
> def __init__(self): pass
> def write(self, string):
> I'm not sure if that'll work. Just thinking out loud really.
I don't think this (overriding sys.stdout) will work for what Gökhan is
trying to do. Unlike displayhook(), which gets an object,
sys.stdout.write() only gets the string form, so you can't easily produce a
For a Python class, you could monkeypatch __str__() to produce your
preferred representation, but ndarray is defined in compiled code, so
that's not an option.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User