IDLE - Customizing output format

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Sep 27 01:34:55 CEST 2006


At Tuesday 26/9/2006 15:29, Ilias Lazaridis wrote:

> >  >>> def f(obj):
> >       print '    ' + repr(obj)
> >
> >  >>> sys.displayhook = f
>
>I've placed this code within /Lib/sitecustomize.py, but have one
>strange result:
>
> >>> from talker import *
> >>> t = Talker()
> >>> t.sayHello
>   : <bound method Talker.sayHello of <talker.Talker instance at
>0x00DEA198>>
> >>> t.sayHello()
>Hello world
>   : None
> >>>
>
>1st: "Hello world" comes still on the beginning.
>2nd: I got this "None"

The replacement should be a bit more complicated, taking None into 
account - see the original PEP for details 
http://www.python.org/dev/peps/pep-0217/
And notice that this replaces the output of *evaluated* expressions, 
not any print statement executed inside your code.


Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list