IDLE - Customizing output format

Ilias Lazaridis ilias at lazaridis.com
Thu Sep 28 18:28:22 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.

you are right. 1 == 0 showed an empty response.

this one seems to work:

def f(obj):
    if obj is not None:
        print '::: ' + repr(obj)

> > > 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.

agree.

> print output goes to sys.stdout, you could replace it.

wouldn't this replace all sdtout of every python programm?

i've tried this one:

sys.sdtout = f

without success within IDLE.

> >I've looked a little at the code, but get immediately demotivated
> >seeing 72 files within a flat directroy:
> >
> >http://svn.python.org/view/python/trunk/Lib/idlelib/?rev=52013
>
> Remember that packages have not existed forever... I've seen worse things :)

ok, me too.

but placing at minimum 2 directories like:

core
gui

could simpify things already very much.

.

--
http://lazaridis.com




More information about the Python-list mailing list