Re: Printing with interspersed element

2008-11-06 Thread Kirk Strauser
At 2008-10-30T21:10:09Z, "Paulo J. Matos" <[EMAIL PROTECTED]> writes: > Thanks for the tip but that has an issue when dealing with potentially > millions of objects. You are creating a string in memory to then dump > to a file [or screen] while you could dump to the file [or screen] as > you go th

Re: Printing with interspersed element

2008-10-31 Thread Marc 'BlackJack' Rintsch
On Thu, 30 Oct 2008 16:40:17 -0500, Grant Edwards wrote: > If you want to do it "on the fly", then try something like this: > > iter = [1,2,3,4,5].__iter__() > sys.stdout.write(str(iter.next())) > for n in iter: > sys.stdout.write(',' +str(n)) Maybe without shadowing the built in `iter()` an

Re: Printing with interspersed element

2008-10-30 Thread Matimus
On Oct 30, 2:10 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: > On Thu, Oct 30, 2008 at 8:42 PM, Arnaud Delobelle > > > > <[EMAIL PROTECTED]> wrote: > > On Oct 30, 8:07 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: > >> Hi all, > > >> I guess this is a recurring issue for someone who doesn't re

Re: Printing with interspersed element

2008-10-30 Thread Grant Edwards
On 2008-10-30, Paulo J. Matos <[EMAIL PROTECTED]> wrote: > On Thu, Oct 30, 2008 at 8:42 PM, Arnaud Delobelle ><[EMAIL PROTECTED]> wrote: >> On Oct 30, 8:07 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: >>> Hi all, >>> >>> I guess this is a recurring issue for someone who doesn't really know >>> t

Re: Printing with interspersed element

2008-10-30 Thread Arnaud Delobelle
On 30 Oct 2008, at 21:10, Paulo J. Matos wrote: On Thu, Oct 30, 2008 at 8:42 PM, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: On Oct 30, 8:07 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: Hi all, I guess this is a recurring issue for someone who doesn't really know the python lib inside

Re: Printing with interspersed element

2008-10-30 Thread Grant Edwards
On 2008-10-30, Paulo J. Matos <[EMAIL PROTECTED]> wrote: >> print ' 10 '.join(str(x) for x in lst) > > Thanks for the tip but that has an issue when dealing with potentially > millions of objects. You are creating a string in memory to then dump > to a file [or screen] while you could dump to the

Re: Printing with interspersed element

2008-10-30 Thread Paulo J. Matos
On Thu, Oct 30, 2008 at 8:42 PM, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Oct 30, 8:07 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: >> Hi all, >> >> I guess this is a recurring issue for someone who doesn't really know >> the python lib inside out. There must be a simple way to do this.

Re: Printing with interspersed element

2008-10-30 Thread Arnaud Delobelle
On Oct 30, 8:07 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: > Hi all, > > I guess this is a recurring issue for someone who doesn't really know > the python lib inside out. There must be a simple way to do this. > I have a list of objects [x1, x2, x3, ..., xn] and I have defined a > print metho

Re: Printing with interspersed element

2008-10-30 Thread Grant Edwards
On 2008-10-30, Paulo J. Matos <[EMAIL PROTECTED]> wrote: > Hi all, > > I guess this is a recurring issue for someone who doesn't really know > the python lib inside out. There must be a simple way to do this. > I have a list of objects [x1, x2, x3, ..., xn] and I have defined a > print method for t

Printing with interspersed element

2008-10-30 Thread Paulo J. Matos
Hi all, I guess this is a recurring issue for someone who doesn't really know the python lib inside out. There must be a simple way to do this. I have a list of objects [x1, x2, x3, ..., xn] and I have defined a print method for them print_obj(). Now I want to print them intersepersed by an elemen