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

Discussion in 'Python' started by alf, Aug 29, 2006.

  1. alf

    alf Guest

    Hi,

    is there any way in Python to have iostream like __str__ operator?
     
    alf, Aug 29, 2006
    #1
    1. Advertisements

  2. 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
     
    Gabriel Genellina, Aug 29, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.