__str__ for large objects, would not c++ iostream be more efficient

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Aug 29 00:17:15 EDT 2006


At Tuesday 29/8/2006 00:04, alf wrote:

>is there any way in Python to have iostream like __str__ operator?

Define a method writeTo(f) if you want, and instead of:

         f.write('%s' % obj)

use:

         obj.writeTo(f)



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