__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
     
    alf, Aug 29, 2006
    #1
    1. Advertising

  2. Re: __str__ for large objects, would not c++ iostream be moreefficient

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

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Tiger
    Replies:
    10
    Views:
    5,652
  2. Juergen Marsch
    Replies:
    1
    Views:
    1,320
    Asfand Yar Qazi
    Jun 21, 2004
  3. ai@work
    Replies:
    9
    Views:
    562
    Ron Natalie
    Dec 16, 2004
  4. S. Nurbe

    iostream + iostream.h

    S. Nurbe, Jan 14, 2005, in forum: C++
    Replies:
    7
    Views:
    795
    red floyd
    Jan 15, 2005
  5. red floyd
    Replies:
    3
    Views:
    552
    Dietmar Kuehl
    Mar 8, 2005
Loading...

Share This Page