IDLE - Customizing output format

Ilias Lazaridis ilias at lazaridis.com
Sat Oct 7 19:11:24 EDT 2006


Gabriel Genellina wrote:
> At Wednesday 27/9/2006 09:29, Ilias Lazaridis wrote:
>
> >import sys
> >def f(obj):
> >     if obj:
> >         print '::: ' + repr(obj)
> >sys.displayhook = f
>
> Have you tried that? You have to filter out None, not *any* False value.
>
> > > And notice that this replaces the output of *evaluated* expressions,
> > > not any print statement executed inside your code.
> >
> >Any simple solution for this?
>
> Displaying things interactively is not the same as executing a print
> statement inside the code - I feel right they are not considered the
> same thing. print output goes to sys.stdout, you could replace it.

this is nicely described here:

http://www.voidspace.org.uk/python/weblog/arch_d7_2006_01_21.shtml#e192

do i need the "getattr" and "writeline" methods in MyStdOut?

.

--
http://case.lazaridis.com/ticket/10




More information about the Python-list mailing list